Message ID | 20211231114901.976937-1-philmd@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | hw/dma: Introduce dma_size_t type definition | expand |
On 12/31/21 12:49, Philippe Mathieu-Daudé wrote: > Since the previous commit, dma_buf_rw() returns a MemTxResult > type. Do not discard it, return it to the caller. > > Since both dma_buf_read/dma_buf_write functions were previously > returning the QEMUSGList size not consumed, add an extra argument > where the unconsummed size can be stored. > > Update the few callers. > > Reviewed-by: Klaus Jensen <k.jensen@samsung.com> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > include/hw/scsi/scsi.h | 2 +- > include/sysemu/dma.h | 6 +++-- > hw/ide/ahci.c | 8 +++--- > hw/nvme/ctrl.c | 4 +-- > hw/scsi/megasas.c | 59 ++++++++++++++++++++++++++++++------------ > hw/scsi/scsi-bus.c | 6 +++-- > softmmu/dma-helpers.c | 18 +++++-------- > 7 files changed, 63 insertions(+), 40 deletions(-) > > diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h > index b27d133b113..1ffb367f94f 100644 > --- a/include/hw/scsi/scsi.h > +++ b/include/hw/scsi/scsi.h > @@ -30,7 +30,7 @@ struct SCSIRequest { > int16_t status; > int16_t host_status; > void *hba_private; > - size_t residual; > + uint64_t residual; Oops I forgot to mention this change since the previous version. > SCSICommand cmd; > NotifierList cancel_notifiers; > > diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h > index 45a2567848c..77a346d5ed1 100644 > --- a/include/sysemu/dma.h > +++ b/include/sysemu/dma.h > @@ -303,8 +303,10 @@ BlockAIOCB *dma_blk_read(BlockBackend *blk, > BlockAIOCB *dma_blk_write(BlockBackend *blk, > QEMUSGList *sg, uint64_t offset, uint32_t align, > BlockCompletionFunc *cb, void *opaque); > -uint64_t dma_buf_read(void *ptr, int32_t len, QEMUSGList *sg, MemTxAttrs attrs); > -uint64_t dma_buf_write(void *ptr, int32_t len, QEMUSGList *sg, MemTxAttrs attrs); > +MemTxResult dma_buf_read(void *ptr, dma_size_t len, dma_size_t *residual, > + QEMUSGList *sg, MemTxAttrs attrs); > +MemTxResult dma_buf_write(void *ptr, dma_size_t len, dma_size_t *residual, > + QEMUSGList *sg, MemTxAttrs attrs); >