From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2lrs-0003bL-5U for qemu-devel@nongnu.org; Wed, 10 Jun 2015 15:40:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2lrn-0005WK-4x for qemu-devel@nongnu.org; Wed, 10 Jun 2015 15:40:56 -0400 Received: from smtp2-g21.free.fr ([2a01:e0c:1:1599::11]:44847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2lrm-0005Vk-Vb for qemu-devel@nongnu.org; Wed, 10 Jun 2015 15:40:51 -0400 Message-ID: <557891E7.2030904@reactos.org> Date: Wed, 10 Jun 2015 21:37:11 +0200 From: =?UTF-8?B?SGVydsOpIFBvdXNzaW5lYXU=?= MIME-Version: 1.0 References: <1433364350-19380-1-git-send-email-hpoussin@reactos.org> <1433364350-19380-17-git-send-email-hpoussin@reactos.org> <557826F0.5040005@imgtec.com> In-Reply-To: <557826F0.5040005@imgtec.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 16/16] [RFC] 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: Leon Alrae , qemu-devel@nongnu.org Cc: Aurelien Jarno Hi Leon, Le 10/06/2015 14:00, Leon Alrae a =C3=A9crit : > Hi Herv=C3=A9, > > On 03/06/2015 21:45, Herv=C3=A9 Poussineau wrote: >> This fixes Windows NT 4.0/MIPS, which was always bugchecking with >> IRQL_NOT_LESS_OR_EQUAL. >> >> Signed-off-by: Herv=C3=A9 Poussineau >> --- >> hw/dma/rc4030.c | 14 ++++++++++++-- >> 1 file changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c >> index 3efa6de..deac0a8 100644 >> --- a/hw/dma/rc4030.c >> +++ b/hw/dma/rc4030.c >> @@ -681,6 +681,7 @@ static void rc4030_do_dma(void *opaque, int n, uin= t8_t *buf, int len, int is_wri >> rc4030State *s =3D opaque; >> hwaddr dma_addr; >> int dev_to_mem; >> + int i; >> >> s->dma_regs[n][DMA_REG_ENABLE] &=3D ~(DMA_FLAG_TC_INTR | DMA_FLA= G_MEM_INTR | DMA_FLAG_ADDR_INTR); >> >> @@ -699,8 +700,17 @@ static void rc4030_do_dma(void *opaque, int n, ui= nt8_t *buf, int len, int is_wri >> dma_addr =3D s->dma_regs[n][DMA_REG_ADDRESS]; >> >> /* Read/write data at right place */ >> - address_space_rw(&s->dma_as, dma_addr, MEMTXATTRS_UNSPECIFIED, >> - buf, len, is_write); >> + for (i =3D 0; i < len; ) { >> + int ncpy =3D DMA_PAGESIZE - (dma_addr & (DMA_PAGESIZE - 1)); >> + if (ncpy > len - i) { >> + ncpy =3D len - i; >> + } >> + address_space_rw(&s->dma_as, dma_addr, MEMTXATTRS_UNSPECIFIED= , >> + buf + i, ncpy, is_write); >> + >> + dma_addr +=3D ncpy; >> + i +=3D ncpy; >> + } >> >> s->dma_regs[n][DMA_REG_ENABLE] |=3D DMA_FLAG_TC_INTR; >> s->dma_regs[n][DMA_REG_COUNT] -=3D len; >> > > I'm sending out current target-mips queue soon and I can include this s= eries, > but I'm not quite sure what to do with this RFC patch. I presume you pu= t RFC > here because it's a workaround for a bug, but it's not clear where the = actual > bug is? Indeed, that's a workaround for a bug that I failed to identify. You can = still take the RFC patch as a patch, as I didn't see any objection (yet). I think we can defer the bug correction for later. Regards, Herv=C3=A9