From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxKFJ-0001BD-HB for qemu-devel@nongnu.org; Thu, 11 Jul 2013 13:01:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UxKFE-0001P8-IB for qemu-devel@nongnu.org; Thu, 11 Jul 2013 13:01:33 -0400 From: Alexander Graf Date: Thu, 11 Jul 2013 19:01:25 +0200 Message-Id: <1373562085-29728-23-git-send-email-agraf@suse.de> In-Reply-To: <1373562085-29728-1-git-send-email-agraf@suse.de> References: <1373562085-29728-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 22/22] PPC: dbdma: Support more multi-issue DMA requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , qemu-ppc@nongnu.org, Aurelien Jarno A DMA request can happen for data that hasn't been completely been provided by the IDE core yet. For example - DBDMA request for 0x1000 bytes - IDE request for 1 sector - DBDMA wants to read 0x1000 bytes (8 sectors) from bdrv - breakage Instead, we should truncate our bdrv request to the maximum number of sectors we're allowed to read at that given time. Once that transfer is through, we will fall into our recently introduced waiting logic. - DBDMA requests for 0x1000 bytes - IDE request for 1 sector - DBDMA wants to read MIN(0x1000, 1 * 512) bytes - DBDMA finishes reading, indicates to IDE core that transfer is complete - IDE request for 7 sectors - DBDMA finishes the DMA Reported-by: Mark Cave-Ayland Signed-off-by: Alexander Graf --- hw/ide/macio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 18bc1d1..38ad924 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -87,7 +87,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret) s->io_buffer_index &= 0x7ff; } - s->io_buffer_size = io->len; + s->io_buffer_size = MIN(io->len, s->packet_transfer_size); MACIO_DPRINTF("remainder: %d io->len: %d size: %d\n", io->remainder_len, io->len, s->packet_transfer_size); @@ -253,7 +253,7 @@ static void pmac_ide_transfer_cb(void *opaque, int ret) /* launch next transfer */ s->io_buffer_index = 0; - s->io_buffer_size = io->len; + s->io_buffer_size = MIN(io->len, s->nsector * 512); /* handle unaligned accesses first, get them over with and only do the remaining bulk transfer using our async DMA helpers */ -- 1.8.1.4