# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1206035253 0
# Node ID f4a92f0db20fda98a633c149e3396c005a759a77
# Parent aedab7d280cb455d749daeb981df68cc0b1bcf52
ioemu: improve DMA transfers
by increasing the size of DMA buffers.
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
tools/ioemu/hw/ide.c | 23 ++++++++++++++++-------
tools/ioemu/hw/scsi-disk.c | 5 +++--
2 files changed, 19 insertions(+), 9 deletions(-)
diff -r aedab7d280cb -r f4a92f0db20f tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c Thu Mar 20 17:47:05 2008 +0000
+++ b/tools/ioemu/hw/ide.c Thu Mar 20 17:47:33 2008 +0000
@@ -189,6 +189,15 @@
/* set to 1 set disable mult support */
#define MAX_MULT_SECTORS 16
+#ifdef CONFIG_STUBDOM
+#include <xen/io/blkif.h>
+#define IDE_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
+#else
+#define IDE_DMA_BUF_SIZE 131072
+#endif
+#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 */
@@ -932,8 +941,8 @@ static void ide_read_dma_cb(void *opaque
/* 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
@@ -1041,8 +1050,8 @@ static void ide_write_dma_cb(void *opaqu
/* 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;
@@ -1336,8 +1345,8 @@ static void ide_atapi_cmd_read_dma_cb(vo
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;
}
@@ -2305,7 +2314,7 @@ static void ide_init2(IDEState *ide_stat
for(i = 0; i < 2; i++) {
s = ide_state + i;
- s->io_buffer = qemu_memalign(getpagesize(), MAX_MULT_SECTORS*512 + 4);
+ s->io_buffer = qemu_memalign(getpagesize(), IDE_DMA_BUF_SIZE + 4);
if (i == 0)
s->bs = hd0;
else
diff -r aedab7d280cb -r f4a92f0db20f tools/ioemu/hw/scsi-disk.c
--- a/tools/ioemu/hw/scsi-disk.c Thu Mar 20 17:47:05 2008 +0000
+++ b/tools/ioemu/hw/scsi-disk.c Thu Mar 20 17:47:33 2008 +0000
@@ -34,9 +34,10 @@ do { fprintf(stderr, "scsi-disk: " fmt ,
#define SENSE_ILLEGAL_REQUEST 5
#ifdef CONFIG_STUBDOM
-#define SCSI_DMA_BUF_SIZE 32768
+#include <xen/io/blkif.h>
+#define SCSI_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST *
TARGET_PAGE_SIZE)
#else
-#define SCSI_DMA_BUF_SIZE 65536
+#define SCSI_DMA_BUF_SIZE 131072
#endif
typedef struct SCSIRequest {
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|