Skip to content

Commit

Permalink
dma: Let dma_buf_rw() take MemTxAttrs argument
Browse files Browse the repository at this point in the history
Let devices specify transaction attributes when calling dma_buf_rw().

Keep the default MEMTXATTRS_UNSPECIFIED in the 2 callers.

Reviewed-by: Klaus Jensen <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
philmd committed Dec 31, 2021
1 parent e2d784b commit 959384e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions softmmu/dma-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ BlockAIOCB *dma_blk_write(BlockBackend *blk,


static uint64_t dma_buf_rw(void *buf, int32_t len, QEMUSGList *sg,
DMADirection dir)
DMADirection dir, MemTxAttrs attrs)
{
uint8_t *ptr = buf;
uint64_t resid;
Expand All @@ -307,8 +307,7 @@ static uint64_t dma_buf_rw(void *buf, int32_t len, QEMUSGList *sg,
while (len > 0) {
ScatterGatherEntry entry = sg->sg[sg_cur_index++];
int32_t xfer = MIN(len, entry.len);
dma_memory_rw(sg->as, entry.base, ptr, xfer, dir,
MEMTXATTRS_UNSPECIFIED);
dma_memory_rw(sg->as, entry.base, ptr, xfer, dir, attrs);
ptr += xfer;
len -= xfer;
resid -= xfer;
Expand All @@ -319,12 +318,14 @@ static uint64_t dma_buf_rw(void *buf, int32_t len, QEMUSGList *sg,

uint64_t dma_buf_read(void *ptr, int32_t len, QEMUSGList *sg)
{
return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_FROM_DEVICE);
return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_FROM_DEVICE,
MEMTXATTRS_UNSPECIFIED);
}

uint64_t dma_buf_write(void *ptr, int32_t len, QEMUSGList *sg)
{
return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_TO_DEVICE);
return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_TO_DEVICE,
MEMTXATTRS_UNSPECIFIED);
}

void dma_acct_start(BlockBackend *blk, BlockAcctCookie *cookie,
Expand Down

0 comments on commit 959384e

Please sign in to comment.