From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5IB8-00055t-7s for qemu-devel@nongnu.org; Wed, 17 Jun 2015 14:35:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5IB4-00041P-SB for qemu-devel@nongnu.org; Wed, 17 Jun 2015 14:35:14 -0400 Received: from smtpfb1-g21.free.fr ([212.27.42.9]:46685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5IB4-0003yP-NH for qemu-devel@nongnu.org; Wed, 17 Jun 2015 14:35:10 -0400 Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) by smtpfb1-g21.free.fr (Postfix) with ESMTP id A02807944E0 for ; Wed, 17 Jun 2015 20:35:04 +0200 (CEST) Message-ID: <5581BCFA.40503@reactos.org> Date: Wed, 17 Jun 2015 20:31:22 +0200 From: =?ISO-8859-15?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 References: <1434054631-32241-1-git-send-email-hpoussin@reactos.org> <20150611233006.GA14284@aurel32.net> <557F3943.1040300@reactos.org> <20150616174846.GA17031@aurel32.net> <558130CA.4030502@redhat.com> <5581A9B7.3040700@redhat.com> In-Reply-To: <5581A9B7.3040700@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] dma/rc4030: do multiple calls to address_space_rw when doing DMA transfers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Aurelien Jarno Cc: Peter Maydell , Leon Alrae , qemu-devel@nongnu.org Le 17/06/2015 19:09, Paolo Bonzini a =E9crit : > > > On 17/06/2015 10:33, Paolo Bonzini wrote: >> On 16/06/2015 19:48, Aurelien Jarno wrote: >>> The code assumes that if you don't have an IOMMU, the address range i= n >>> the underlying memory region is linear. >> >> I think this is exactly what Peter Crosthwaite's infamous :) "exec: >> Respect as_translate_internal length clamp" patch was trying to fix. >> However, address_space_translate_internal uses section->mr->size inste= ad >> of section->size. I'll post a patch once I'm through the email deluge >> from 1 week of absence. > > Can you test this? Sure. It works well for my test case. Thanks Paolo! However, it breaks PC machines. mtree gives: 0000000000000cf8-0000000000000cfb (prio 0, RW): pci-conf-idx 0000000000000cf9-0000000000000cf9 (prio 1, RW): piix3-reset-control "make check" wants to write 4 bytes to 0xcf8. Your patch makes it write o= nly 1 byte, and bad things happen. > > diff --git a/exec.c b/exec.c > index 76bfc4a..fabb8bb 100644 > --- a/exec.c > +++ b/exec.c > @@ -350,7 +350,7 @@ > address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, > hwaddr *x > /* Compute offset within MemoryRegion */ > *xlat =3D addr + section->offset_within_region; > > - diff =3D int128_sub(section->mr->size, int128_make64(addr)); > + diff =3D int128_sub(section->size, int128_make64(addr)); > *plen =3D int128_get64(int128_min(diff, int128_make64(*plen))); > return section; > } > > Paolo >