From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5kXB-0004Sg-9G for qemu-devel@nongnu.org; Wed, 25 May 2016 21:56:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5kX9-0006FK-9B for qemu-devel@nongnu.org; Wed, 25 May 2016 21:56:24 -0400 Date: Thu, 26 May 2016 11:51:29 +1000 From: David Gibson Message-ID: <20160526015129.GW17226@voom.fritz.box> References: <1462344751-28281-1-git-send-email-aik@ozlabs.ru> <1462344751-28281-6-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xi8lRpXYeGgNnUjs" Content-Disposition: inline In-Reply-To: <1462344751-28281-6-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH qemu v16 05/19] 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: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Alexander Graf , Alex Williamson , Paolo Bonzini --xi8lRpXYeGgNnUjs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 04, 2016 at 04:52:17PM +1000, 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, I think this is a reasonable sanity check regardless of what happens with the rest of the series. Can you apply this? > --- > Changes: > v15: > * added some spaces >=20 > 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 f32cc49..6d23d0f 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 : "= none"); > + 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 --xi8lRpXYeGgNnUjs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXRlahAAoJEGw4ysog2bOS0vgQAJDZsm53YP3kh9H7oUTW/QV5 zSLlYvE6K+oq/ju2pk4hWW1jiWqQasIC/7C+091ryYHBnvx6FYDkQb9L/UpFt0QK gefdU7rO/GFq6KvIVm5ObR8Dvw6VvCONBzqU1H7cW/1O0fwSmAufc5CHcFgrdKRp IITvqfV34WD4tCFWj2/0AnD+SoluS95250NU5KQoaeLyEwlAnKN8NFoCuFbpmU3M Qce1qTSx1OcdmTAVf02ZwWPFErztY1mDXrVmznnVW2nDPfhw/DSke4uGmKTxA8o6 kMjZRPq7UvD2XoLCbfM9KimJ71kTiVd0k7BA52nypqB3kuGu4JcHvJoCqQNa6l7i WGCCV1CrZo/7xwj0lUifmzC8CvbFk2C1HnrZq+zs2q82Y5R1EPybkoljuXwbzVQg 88aiaRXpzeQwkNFfS8T23uWhbtZ+RnOnHT/J0TmsU/rx5jbCc9wrmjeyt8OusISi FJEcgAhsOTeIINALdCOFjh/g22rxBqVzUW9NQpxprh//i1m2gJyVnCl9h2RGG0+I cFf6UrKeEhHkmaCIWPykMWdh7iW5Ap5so8eW6GE/QifQ3AUPFpSOgiLrwTsQg7OS +o9Dn1uJAIEZhr3Yw1zzsVI0e9vCTP9gR8VbAQt1MrXmBdTO8rRZhnWdcTZv3rVI zL0NRSrUe+RI6WG1FyqI =ZGzP -----END PGP SIGNATURE----- --xi8lRpXYeGgNnUjs--