From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfLoM-0005Hs-M5 for qemu-devel@nongnu.org; Fri, 25 Sep 2015 01:44:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfLoL-0003qf-Hn for qemu-devel@nongnu.org; Fri, 25 Sep 2015 01:44:46 -0400 Date: Fri, 25 Sep 2015 15:21:42 +1000 From: David Gibson Message-ID: <20150925052142.GC11620@voom.redhat.com> References: <1443069231-14856-1-git-send-email-david@gibson.dropbear.id.au> <1443069231-14856-5-git-send-email-david@gibson.dropbear.id.au> <1443115934.23936.568.camel@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nmemrqcdn5VTmUEE" Content-Disposition: inline In-Reply-To: <1443115934.23936.568.camel@redhat.com> Subject: Re: [Qemu-devel] [PATCH 4/7] vfio: Record host IOMMU's available IO page sizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: lvivier@redhat.com, thuth@redhat.com, abologna@redhat.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, pbonzini@redhat.com --nmemrqcdn5VTmUEE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 24, 2015 at 11:32:14AM -0600, Alex Williamson wrote: > On Thu, 2015-09-24 at 14:33 +1000, David Gibson wrote: > > Depending on the host IOMMU type we determine and record the available = page > > sizes for IOMMU translation. We'll need this for other validation in > > future patches. > >=20 > > Signed-off-by: David Gibson > > Reviewed-by: Thomas Huth > > Reviewed-by: Laurent Vivier > > --- > > hw/vfio/common.c | 13 +++++++++++++ > > include/hw/vfio/vfio-common.h | 1 + > > 2 files changed, 14 insertions(+) > >=20 > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > > index f90cc75..db8dff3 100644 > > --- a/hw/vfio/common.c > > +++ b/hw/vfio/common.c > > @@ -677,6 +677,7 @@ static int vfio_connect_container(VFIOGroup *group,= AddressSpace *as) > > if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) || > > ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) { > > bool v2 =3D !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOM= MU); > > + struct vfio_iommu_type1_info info; > > =20 > > ret =3D ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd); > > if (ret) { > > @@ -702,6 +703,15 @@ static int vfio_connect_container(VFIOGroup *group= , AddressSpace *as) > > */ > > container->min_iova =3D 0; > > container->max_iova =3D (hwaddr)-1; > > + > > + /* Assume just 4K IOVA page size */ > > + container->iova_pgsizes =3D 0x1000; > > + info.argsz =3D sizeof(info); > > + ret =3D ioctl(fd, VFIO_IOMMU_GET_INFO, &info); > > + /* Ignore errors */ > > + if ((ret =3D=3D 0) && (info.flags & VFIO_IOMMU_INFO_PGSIZES)) { > > + container->iova_pgsizes =3D info.iova_pgsizes; > > + } > > } else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU)) { > > struct vfio_iommu_spapr_tce_info info; > > =20 > > @@ -744,6 +754,9 @@ static int vfio_connect_container(VFIOGroup *group,= AddressSpace *as) > > } > > container->min_iova =3D info.dma32_window_start; > > container->max_iova =3D container->min_iova + info.dma32_windo= w_size - 1; > > + > > + /* Assume just 4K IOVA pages for now */ >=20 >=20 > Ironically, no FIXME ;) :p --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --nmemrqcdn5VTmUEE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWBNnmAAoJEGw4ysog2bOSAEsP/RqdH3M4ndNkYcCUJrkmu4Uq bjQoSGEyNkWpWJkKtD3bE8w5HgBdS27O1PMs7Di3V0wUr5HjG8+dbB9XHVnqIPME 6CZNJloVFFEjdffLPdm5C3BOdIpjJaHUEZBAZT/n8Vt9t/DbeTWp0a/CHI2zv1jC H60T9S+qBhUMQLHHG0tmhFgdbHxBiA3jzuBqAcilNuCNA8xh1TwPamTKGuRpL+OZ xm+IetwwhzawNaAHFRcWozn5qsEJwYUcS5KNGrlRUS8kM4475TZKy+L1/xXx02K5 u+m4bqKUsBEEglZsu9UgsnCj9du5rlcbXald8LSttl3EfR0G57RzqpQvYqXFDRom hrWqqa54Q2qYatbi1LakdQWvSfYdeL6Mz00hHnrP9TCfsyoXob3RyZhTC7EXUWgV GiXpWzmQAENDrLk2U4/Rn9sGs7QOe3vwQDGmIHcg5BAg4Hom6eOa3l87P6SejeXD BfWezx4SclU7G7QFS9YcRV7FKjVrxGXlTUfVOC95pdtJimvH7pjT70NJhQTjZnAC x/sLUR0NiQgDHkg5gGTBM6YQHu57uifgfzFasD9HEXxAMK56WuCjb0kdN48Hcdu6 LKntfksVSK6wfV8GuXNXZgIbWSaIZGo7PKYJagrklQa5DgZzycIOWp6qMNIn2oGY VIR0rcyzbmK//R8f7QQ7 =m6iH -----END PGP SIGNATURE----- --nmemrqcdn5VTmUEE--