From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxaN5-0005xT-D4 for qemu-devel@nongnu.org; Wed, 27 May 2015 08:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxaN3-0002sp-8K for qemu-devel@nongnu.org; Wed, 27 May 2015 08:23:43 -0400 Received: from smtp2-g21.free.fr ([2a01:e0c:1:1599::11]:33170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxaN3-0002qt-2y for qemu-devel@nongnu.org; Wed, 27 May 2015 08:23:41 -0400 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 27 May 2015 14:20:00 +0200 Message-Id: <1432729200-5322-18-git-send-email-hpoussin@reactos.org> In-Reply-To: <1432729200-5322-1-git-send-email-hpoussin@reactos.org> References: <1432729200-5322-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 17/17] [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: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Leon Alrae , Aurelien Jarno , Paolo Bonzini This fixes Windows NT 4.0/MIPS, which was always bugchecking with IRQL_NOT_LESS_OR_EQUAL. Cc: Paolo Bonzini --- 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, uint8_= t *buf, int len, int is_wri rc4030State *s =3D opaque; hwaddr dma_addr; int dev_to_mem; + int i; =20 s->dma_regs[n][DMA_REG_ENABLE] &=3D ~(DMA_FLAG_TC_INTR | DMA_FLAG_ME= M_INTR | DMA_FLAG_ADDR_INTR); =20 @@ -699,8 +700,17 @@ static void rc4030_do_dma(void *opaque, int n, uint8= _t *buf, int len, int is_wri dma_addr =3D s->dma_regs[n][DMA_REG_ADDRESS]; =20 /* 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; + } =20 s->dma_regs[n][DMA_REG_ENABLE] |=3D DMA_FLAG_TC_INTR; s->dma_regs[n][DMA_REG_COUNT] -=3D len; --=20 2.1.4