aboutsummaryrefslogtreecommitdiff
path: root/dma-helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'dma-helpers.c')
-rw-r--r--dma-helpers.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/dma-helpers.c b/dma-helpers.c
index 4ad0bca67e..a6cc15f534 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -73,7 +73,7 @@ typedef struct {
BlockBackend *blk;
BlockAIOCB *acb;
QEMUSGList *sg;
- uint64_t sector_num;
+ uint64_t offset;
DMADirection dir;
int sg_cur_index;
dma_addr_t sg_cur_byte;
@@ -130,7 +130,7 @@ static void dma_blk_cb(void *opaque, int ret)
trace_dma_blk_cb(dbs, ret);
dbs->acb = NULL;
- dbs->sector_num += dbs->iov.size / 512;
+ dbs->offset += dbs->iov.size;
if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) {
dma_complete(dbs, ret);
@@ -164,8 +164,8 @@ static void dma_blk_cb(void *opaque, int ret)
qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK);
}
- dbs->acb = dbs->io_func(dbs->blk, dbs->sector_num, &dbs->iov,
- dbs->iov.size / 512, dma_blk_cb, dbs);
+ dbs->acb = dbs->io_func(dbs->blk, dbs->offset, &dbs->iov, 0,
+ dma_blk_cb, dbs);
assert(dbs->acb);
}
@@ -203,7 +203,7 @@ BlockAIOCB *dma_blk_io(
dbs->acb = NULL;
dbs->blk = blk;
dbs->sg = sg;
- dbs->sector_num = sector_num;
+ dbs->offset = sector_num << BDRV_SECTOR_BITS;
dbs->sg_cur_index = 0;
dbs->sg_cur_byte = 0;
dbs->dir = dir;
@@ -219,7 +219,7 @@ BlockAIOCB *dma_blk_read(BlockBackend *blk,
QEMUSGList *sg, uint64_t sector,
void (*cb)(void *opaque, int ret), void *opaque)
{
- return dma_blk_io(blk, sg, sector, blk_aio_readv, cb, opaque,
+ return dma_blk_io(blk, sg, sector, blk_aio_preadv, cb, opaque,
DMA_DIRECTION_FROM_DEVICE);
}
@@ -227,7 +227,7 @@ BlockAIOCB *dma_blk_write(BlockBackend *blk,
QEMUSGList *sg, uint64_t sector,
void (*cb)(void *opaque, int ret), void *opaque)
{
- return dma_blk_io(blk, sg, sector, blk_aio_writev, cb, opaque,
+ return dma_blk_io(blk, sg, sector, blk_aio_pwritev, cb, opaque,
DMA_DIRECTION_TO_DEVICE);
}