ia64/xen-unstable

changeset 17284:f4a92f0db20f

ioemu: improve DMA transfers
by increasing the size of DMA buffers.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Mar 20 17:47:33 2008 +0000 (2008-03-20)
parents aedab7d280cb
children 491a3b62ae5b
files tools/ioemu/hw/ide.c tools/ioemu/hw/scsi-disk.c
line diff
     1.1 --- a/tools/ioemu/hw/ide.c	Thu Mar 20 17:47:05 2008 +0000
     1.2 +++ b/tools/ioemu/hw/ide.c	Thu Mar 20 17:47:33 2008 +0000
     1.3 @@ -189,6 +189,15 @@
     1.4  
     1.5  /* set to 1 set disable mult support */
     1.6  #define MAX_MULT_SECTORS 16
     1.7 +#ifdef CONFIG_STUBDOM
     1.8 +#include <xen/io/blkif.h>
     1.9 +#define IDE_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
    1.10 +#else
    1.11 +#define IDE_DMA_BUF_SIZE 131072
    1.12 +#endif
    1.13 +#if (IDE_DMA_BUF_SIZE < MAX_MULT_SECTORS * 512)
    1.14 +#error "IDE_DMA_BUF_SIZE must be bigger or equal to MAX_MULT_SECTORS * 512"
    1.15 +#endif
    1.16  
    1.17  /* ATAPI defines */
    1.18  
    1.19 @@ -932,8 +941,8 @@ static void ide_read_dma_cb(void *opaque
    1.20  
    1.21      /* launch next transfer */
    1.22      n = s->nsector;
    1.23 -    if (n > MAX_MULT_SECTORS)
    1.24 -        n = MAX_MULT_SECTORS;
    1.25 +    if (n > IDE_DMA_BUF_SIZE / 512)
    1.26 +        n = IDE_DMA_BUF_SIZE / 512;
    1.27      s->io_buffer_index = 0;
    1.28      s->io_buffer_size = n * 512;
    1.29  #ifdef DEBUG_AIO
    1.30 @@ -1041,8 +1050,8 @@ static void ide_write_dma_cb(void *opaqu
    1.31  
    1.32      /* launch next transfer */
    1.33      n = s->nsector;
    1.34 -    if (n > MAX_MULT_SECTORS)
    1.35 -        n = MAX_MULT_SECTORS;
    1.36 +    if (n > IDE_DMA_BUF_SIZE / 512)
    1.37 +        n = IDE_DMA_BUF_SIZE / 512;
    1.38      s->io_buffer_index = 0;
    1.39      s->io_buffer_size = n * 512;
    1.40  
    1.41 @@ -1336,8 +1345,8 @@ static void ide_atapi_cmd_read_dma_cb(vo
    1.42          data_offset = 16;
    1.43      } else {
    1.44          n = s->packet_transfer_size >> 11;
    1.45 -        if (n > (MAX_MULT_SECTORS / 4))
    1.46 -            n = (MAX_MULT_SECTORS / 4);
    1.47 +        if (n > (IDE_DMA_BUF_SIZE / 2048))
    1.48 +            n = (IDE_DMA_BUF_SIZE / 2048);
    1.49          s->io_buffer_size = n * 2048;
    1.50          data_offset = 0;
    1.51      }
    1.52 @@ -2305,7 +2314,7 @@ static void ide_init2(IDEState *ide_stat
    1.53  
    1.54      for(i = 0; i < 2; i++) {
    1.55          s = ide_state + i;
    1.56 -        s->io_buffer = qemu_memalign(getpagesize(), MAX_MULT_SECTORS*512 + 4);
    1.57 +        s->io_buffer = qemu_memalign(getpagesize(), IDE_DMA_BUF_SIZE + 4);
    1.58          if (i == 0)
    1.59              s->bs = hd0;
    1.60          else
     2.1 --- a/tools/ioemu/hw/scsi-disk.c	Thu Mar 20 17:47:05 2008 +0000
     2.2 +++ b/tools/ioemu/hw/scsi-disk.c	Thu Mar 20 17:47:33 2008 +0000
     2.3 @@ -34,9 +34,10 @@ do { fprintf(stderr, "scsi-disk: " fmt ,
     2.4  #define SENSE_ILLEGAL_REQUEST 5
     2.5  
     2.6  #ifdef CONFIG_STUBDOM
     2.7 -#define SCSI_DMA_BUF_SIZE    32768
     2.8 +#include <xen/io/blkif.h>
     2.9 +#define SCSI_DMA_BUF_SIZE    (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
    2.10  #else
    2.11 -#define SCSI_DMA_BUF_SIZE    65536
    2.12 +#define SCSI_DMA_BUF_SIZE    131072
    2.13  #endif
    2.14  
    2.15  typedef struct SCSIRequest {