From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiCuH-0005cF-AD for qemu-devel@nongnu.org; Mon, 21 Mar 2016 23:22:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiCuG-0002kK-4q for qemu-devel@nongnu.org; Mon, 21 Mar 2016 23:22:57 -0400 Date: Tue, 22 Mar 2016 14:05:15 +1100 From: David Gibson Message-ID: <20160322030515.GZ23586@voom.redhat.com> References: <1458546426-26222-1-git-send-email-aik@ozlabs.ru> <1458546426-26222-13-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SqEPCaGsKgsesFh5" Content-Disposition: inline In-Reply-To: <1458546426-26222-13-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH qemu v14 12/18] vfio: Check that IOMMU MR translates to system address space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Alex Williamson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org --SqEPCaGsKgsesFh5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 21, 2016 at 06:47:00PM +1100, Alexey Kardashevskiy wrote: > At the moment IOMMU MR only translate to the system memory. > However if some new code changes this, we will need clear indication why > it is not working so here is the check. >=20 > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson Alex, any chance we could merge this quickly, since it is a reasonable sanity check even without the rest of the changes. > --- > Changes: > v14: > * new to the series > --- > hw/vfio/common.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > index 55723c9..9587c25 100644 > --- a/hw/vfio/common.c > +++ b/hw/vfio/common.c > @@ -266,6 +266,12 @@ static void vfio_iommu_map_notify(Notifier *n, void = *data) > =20 > trace_vfio_iommu_map_notify(iova, iova + iotlb->addr_mask); > =20 > + if (iotlb->target_as !=3D &address_space_memory) { > + error_report("Wrong target AS \"%s\", only system memory is allo= wed", > + iotlb->target_as->name?iotlb->target_as->name:"nona= me"); > + return; > + } > + > /* > * The IOMMU TLB entry we have just covers translation through > * this IOMMU to its immediate target. We need to translate --=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 --SqEPCaGsKgsesFh5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJW8LZqAAoJEGw4ysog2bOSWY0QAJXsW+Y6swEdhgAofTwtocdf xB5M0Xrb0FHUL3qBzfFCg8wI9pge54SeTpWj6ljdOvXz55Hpn4nyZdg5tkIMQQ6O 8UwvRyWUyUZey1KpjY/pnT4yG47SnPYxelSTs2R+bz11X+hlgrB9550yDTrMFLBd 7c70PNQTBFS/fQ8rVXcx0BLjIhgsMkdMyF2ekWiKWI7PVT88H4aoEF4R9yJy1dtp V3Z7gKJwOWl3rqqdhv0FNYY5kr4hHaazBO3OgcpLRtoy/W8dr3dqGVCIh4rTaV81 7jaXp7x3N3zCWJvYeqKKM6F1npPDkK6xAqNegNTNoew8WESdTPrDcDKU5lPkWJpu 7tGfvjTy2qOdCd3KnmyBZmEGcEpsVcMAea27KjXcbAq6rBpHI9jszAKVtyVZZBpR pSCqEnTwb+PyQK3h3ibOhk9Z/n2O5ZQZ6wN6el88nM8jBR039q8TCsFGvYU4jI2K FP5p6gqHwkWksmLAPWBt/sZA2ewXxiQPgWlv4Ep5pAAaQKGip7JmE3HZ8zq9Knwu IzW52yc1H6/vlGg4Q9EFIKlaMTI3K398rzKptw3yafn1V85E6DGhJhhQnGQ5PyMS q/moJPgcnMNnsMEd4aI7A0WCNP2DIDnUALqaPNN1/p+qrkQD1IKiJhbRvxCO3SPt wW4QzWmo3bYe6fOeLVWE =ADBm -----END PGP SIGNATURE----- --SqEPCaGsKgsesFh5--