Received: from eggs.gnu.org ([2001:4830:134:3::10]:43570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFFIW-0008S6-UG for qemu-devel@nongnu.org; Tue, 21 Jun 2016 02:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFFIS-0005cA-LA for qemu-devel@nongnu.org; Tue, 21 Jun 2016 02:36:31 -0400 Date: Tue, 21 Jun 2016 16:16:22 +1000 From: David Gibson Message-ID: <20160621061622.GA17957@voom.fritz.box> References: <1466471645-5396-1-git-send-email-aik@ozlabs.ru> <1466471645-5396-2-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="X1bOJ3K7DJ5YkBrT" Content-Disposition: inline In-Reply-To: <1466471645-5396-2-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH qemu v18 1/5] memory: Add reporting of supported page sizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Alex Williamson , pbonzini@redhat.com --X1bOJ3K7DJ5YkBrT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 21, 2016 at 11:14:01AM +1000, Alexey Kardashevskiy wrote: > Every IOMMU has some granularity which MemoryRegionIOMMUOps::translate > uses when translating, however this information is not available outside > the translate context for various checks. >=20 > This adds a get_min_page_size callback to MemoryRegionIOMMUOps and > a wrapper for it so IOMMU users (such as VFIO) can know the minimum > actual page size supported by an IOMMU. >=20 > As IOMMU MR represents a guest IOMMU, this uses TARGET_PAGE_SIZE > as fallback. >=20 > This removes vfio_container_granularity() and uses new helper in > memory_region_iommu_replay() when replaying IOMMU mappings on added > IOMMU memory region. >=20 > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: David Gibson > Acked-by: Alex Williamson One remaining nit.. [snip] > +void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, bool is_w= rite) > +{ > + hwaddr addr, granularity; > IOMMUTLBEntry iotlb; > =20 > + granularity =3D (hwaddr)1 << ctz64(memory_region_iommu_get_min_page_= size(mr)); Because this is now a plain size, rather than some sort of pagemask, you don't need the ctz64() business. > for (addr =3D 0; addr < memory_region_size(mr); addr +=3D granularit= y) { > iotlb =3D mr->iommu_ops->translate(mr, addr, is_write); > if (iotlb.perm !=3D IOMMU_NONE) { Paolo, are you ok for me to make that small change and take this through my tree? --=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 --X1bOJ3K7DJ5YkBrT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXaNu2AAoJEGw4ysog2bOSMiMP/2/kQkCXWzQTCrdGre7en582 vIDYlYnQyKp0xR2CnLm7Gxa9TdJRY6MrdL5FWDT+tK62F9xL802ekMrGQvq5YdsQ M6XI8RWBTBQa3UYtEqf+EyiDfhvqnpx6V1oltLWqYwKGn7/GlndwzMSzd+y3IsO1 mXHAMjerSeOMG5SyIkrcPKOzbxUT0JANA1iQCP866Hoj5EAOX8gpbstfXA+pDosb 5hP9PJ6UrK3t0kmYYAnqVap5zBX2u3oNNtgo7SMJ4huddiSi3AsBP1T8rlcE7smp lIP8vTOpW9Yxqtv04S9jUR61LvCFb5iVv9oMSEEFMTWwe7uXT6yuMsMKGBm2weJl Df2RN/q5zFe5hfwilJX9WCqNxO4U7FdLEiSKoHKm1AVWpjlsfvtffNradExIl8IH pqupZwDgygnComi5U4CrpHUUaPPvtFvzM56rabBKSh88bhq85goQTgZ/5gmkBvXF ZCcsWfO4pCMhTYMMeoeQUAdRpph6/xJ0jJgFmQ9+yHR/qOEZLLqZXY/48fbEc45O Sfj8ak/dVzI99IeNl1NXEPOys2/toG/kGxODeV+qUVS0yzhEz7xH/zJm4TaOGr7b Zi2t/3Ee/KSTtxdkQoaCLCR2UXmcRiboFe0gzeshz20QnN6SpMof5CI3PLgkPymp Pj6Z2Ljkn3pQqlHeH0st =jhhN -----END PGP SIGNATURE----- --X1bOJ3K7DJ5YkBrT--