From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXOow-000637-TA for qemu-devel@nongnu.org; Wed, 01 May 2013 00:39:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXOos-0005DQ-1o for qemu-devel@nongnu.org; Wed, 01 May 2013 00:39:10 -0400 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:34304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXOor-00058z-MP for qemu-devel@nongnu.org; Wed, 01 May 2013 00:39:05 -0400 Date: Wed, 1 May 2013 14:02:39 +1000 From: David Gibson Message-ID: <20130501040239.GM20202@truffula.fritz.box> References: <1367378320-9246-1-git-send-email-david@gibson.dropbear.id.au> <1367378320-9246-7-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4KEJhRss/+5IzdUf" Content-Disposition: inline In-Reply-To: <1367378320-9246-7-git-send-email-david@gibson.dropbear.id.au> Subject: Re: [Qemu-devel] [PATCH 07/17] memory: add address_space_valid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com Cc: aik@truffula.fritz.box, qemu-devel@nongnu.org --4KEJhRss/+5IzdUf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Paolo, I've been looking through your iommu branch, and spotted a few things, so sending some comments about them. Since I haven't see where they've been posted before (if anywhere), I've kind of reconstructed a mail to reply to from the patch in git. I hope the result isn't too cryptic. On Wed, May 01, 2013 at 01:18:30PM +1000, David Gibson wrote: > From: Paolo Bonzini >=20 > Checking whether an address space is possible in the old-style > IOMMU implementation, but there is no equivalent in the memory API. > Implement it with a lookup of the dispatch tree. >=20 > Signed-off-by: Paolo Bonzini [snip] > --- > dma-helpers.c | 5 +++++ > exec.c | 24 ++++++++++++++++++++++++ > include/exec/memory.h | 12 ++++++++++++ > include/sysemu/dma.h | 3 ++- > 4 files changed, 43 insertions(+), 1 deletion(-) >=20 > diff --git a/dma-helpers.c b/dma-helpers.c > index 272632f..2962b69 100644 > --- a/dma-helpers.c > +++ b/dma-helpers.c > @@ -298,6 +298,11 @@ bool iommu_dma_memory_valid(DMAContext *dma, dma_add= r_t addr, dma_addr_t len, > plen =3D len; > } > =20 > + if (!address_space_valid(dma->as, paddr, len, > + dir =3D=3D DMA_DIRECTION_FROM_DEVICE)) { > + return false; > + } I think the argument to address_space_valid() should be plen, not len. Otherwise we're checking that a range the size of the original area is valid at the target address of just the first page. Of course, since the target address space will usually be falt and much bigger than a page, it's unlikely to trigger. --=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 --4KEJhRss/+5IzdUf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlGAk98ACgkQaILKxv3ab8boJwCfYnLHIYrylKryTbIctmKDltwM 480AniQ3ytyBgByYWOdaMVwo3R8PQp+0 =y3qx -----END PGP SIGNATURE----- --4KEJhRss/+5IzdUf--