qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 8/8] hw/dma: Let dma_buf_read() / dma_buf_write() propagate M


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 8/8] hw/dma: Let dma_buf_read() / dma_buf_write() propagate MemTxResult
Date: Fri, 31 Dec 2021 12:51:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

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);
>  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]