diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2021-12-16 09:36:38 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2022-01-18 12:56:29 +0100 |
commit | f02b664aad8f1aaafbcdf45285f6fcab0a4bd5d0 (patch) | |
tree | 74a5d84b75aaaf285161545e6188ef5327d144f4 /include/sysemu | |
parent | bfa30f3903e0542611196b21f5832a4be5775a21 (diff) |
hw/dma: Let dma_buf_read() / dma_buf_write() propagate MemTxResult
Since commit 292e13142d2, dma_buf_rw() returns a MemTxResult type.
Do not discard it, return it to the caller. Pass the previously
returned value (the QEMUSGList residual size, which was rarely used)
as an optional argument.
With this new API, SCSIRequest::residual might now be accessed via
a pointer. Since the size_t type does not have the same size on
32 and 64-bit host architectures, convert it to a uint64_t, which
is big enough to hold the residual size, and the type is constant
on both 32/64-bit hosts.
Update the few dma_buf_read() / dma_buf_write() callers to the new
API.
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220117125130.131828-1-f4bug@amsat.org>
Diffstat (limited to 'include/sysemu')
-rw-r--r-- | include/sysemu/dma.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 36039c5e68..a1ac5bc1b5 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -301,9 +301,9 @@ BlockAIOCB *dma_blk_read(BlockBackend *blk, BlockAIOCB *dma_blk_write(BlockBackend *blk, QEMUSGList *sg, uint64_t offset, uint32_t align, BlockCompletionFunc *cb, void *opaque); -dma_addr_t dma_buf_read(void *ptr, dma_addr_t len, +MemTxResult dma_buf_read(void *ptr, dma_addr_t len, dma_addr_t *residual, QEMUSGList *sg, MemTxAttrs attrs); -dma_addr_t dma_buf_write(void *ptr, dma_addr_t len, +MemTxResult dma_buf_write(void *ptr, dma_addr_t len, dma_addr_t *residual, QEMUSGList *sg, MemTxAttrs attrs); void dma_acct_start(BlockBackend *blk, BlockAcctCookie *cookie, |