Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JeZLh-0006mJ-Lj for qemu-devel@nongnu.org; Wed, 26 Mar 2008 13:23:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JeZLd-0006en-G1 for qemu-devel@nongnu.org; Wed, 26 Mar 2008 13:23:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeZLc-0006e7-VQ for qemu-devel@nongnu.org; Wed, 26 Mar 2008 13:23:37 -0400 Received: from smtp02.citrix.com ([66.165.176.63]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JeZLc-00070B-Lo for qemu-devel@nongnu.org; Wed, 26 Mar 2008 13:23:37 -0400 Received: from mariner.uk.xensource.com (mariner.uk.xensource.com [172.31.17.38]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id m2QGZ0FT012304 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 26 Mar 2008 09:35:02 -0700 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1JeYaa-0002Nc-5N for qemu-devel@nongnu.org; Wed, 26 Mar 2008 16:35:00 +0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="RcfIWXKt/L" Content-Transfer-Encoding: 7bit Message-ID: <18410.31540.160387.110544@mariner.uk.xensource.com> Date: Wed, 26 Mar 2008 16:35:00 +0000 From: Ian Jackson Subject: [Qemu-devel] [PATCH] Improve DMA transfers by increasing the buffer size. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --RcfIWXKt/L Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit In this patch we increase the DMA buffers in the ide emulation from 8k to 132k, and make it configurable separately from the MAX_MULT_SECTORS for maximum multi-mode transfers. This can improve the performance in some conditions. The patch is cross-ported from xen-unstable hg changeset f4a92f0db20fda98a633c149e3396c005a759a77 Signed-off-by: Ian Jackson Signed-off-by: Samuel Thibault --RcfIWXKt/L Content-Type: text/plain Content-Description: increase ide DMA buffers Content-Disposition: inline; filename="0001-Improve-DMA-transfers-by-increasing-the-size-of-DMA-buffers.txt" Content-Transfer-Encoding: 7bit >From 4eaa19458262cce92f0b891c51433ccee0a19b79 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 26 Mar 2008 16:09:35 +0000 Subject: [PATCH] Improve DMA transfers by increasing the size of DMA buffers. This involves a new constant IDE_DMA_BUF_SIZE which is separate from MAX_MULT_SECTORS. Cross-ported from xen-unstable 17267:f4a92f0db20fda98a633c149e3396c005a759a77 Signed-off-by: Ian Jackson Signed-off-by: Samuel Thibault --- hw/ide.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/ide.c b/hw/ide.c index 56a1cda..b73dba2 100644 --- a/hw/ide.c +++ b/hw/ide.c @@ -202,6 +202,12 @@ /* set to 1 set disable mult support */ #define MAX_MULT_SECTORS 16 +#define IDE_DMA_BUF_SIZE 131072 + +#if (IDE_DMA_BUF_SIZE < MAX_MULT_SECTORS * 512) +#error "IDE_DMA_BUF_SIZE must be bigger or equal to MAX_MULT_SECTORS * 512" +#endif + /* ATAPI defines */ #define ATAPI_PACKET_SIZE 12 @@ -920,8 +926,8 @@ static void ide_read_dma_cb(void *opaque, int ret) /* launch next transfer */ n = s->nsector; - if (n > MAX_MULT_SECTORS) - n = MAX_MULT_SECTORS; + if (n > IDE_DMA_BUF_SIZE / 512) + n = IDE_DMA_BUF_SIZE / 512; s->io_buffer_index = 0; s->io_buffer_size = n * 512; #ifdef DEBUG_AIO @@ -1028,8 +1034,8 @@ static void ide_write_dma_cb(void *opaque, int ret) /* launch next transfer */ n = s->nsector; - if (n > MAX_MULT_SECTORS) - n = MAX_MULT_SECTORS; + if (n > IDE_DMA_BUF_SIZE / 512) + n = IDE_DMA_BUF_SIZE / 512; s->io_buffer_index = 0; s->io_buffer_size = n * 512; @@ -1323,8 +1329,8 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) data_offset = 16; } else { n = s->packet_transfer_size >> 11; - if (n > (MAX_MULT_SECTORS / 4)) - n = (MAX_MULT_SECTORS / 4); + if (n > (IDE_DMA_BUF_SIZE / 2048)) + n = (IDE_DMA_BUF_SIZE / 2048); s->io_buffer_size = n * 2048; data_offset = 0; } @@ -2557,7 +2563,7 @@ static void ide_init2(IDEState *ide_state, for(i = 0; i < 2; i++) { s = ide_state + i; - s->io_buffer = qemu_memalign(512, MAX_MULT_SECTORS*512 + 4); + s->io_buffer = qemu_memalign(512, IDE_DMA_BUF_SIZE + 4); if (i == 0) s->bs = hd0; else -- 1.4.4.4 --RcfIWXKt/L--