[PATCH v2 0/9] hw/dma: Use dma_addr_t type definition when relevant

Philippe Mathieu-Daudé posted 9 patches 2 years, 2 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220104085431.2122999-1-f4bug@amsat.org
There is a newer version of this series
hw/rdma/rdma_utils.h   |  2 +-
include/hw/pci/pci.h   | 12 ++++++
include/hw/scsi/scsi.h |  4 +-
include/sysemu/dma.h   | 31 ++++++++-------
hw/ide/ahci.c          | 10 ++---
hw/nvme/ctrl.c         |  6 +--
hw/rdma/rdma_utils.c   | 14 +++----
hw/scsi/megasas.c      | 85 +++++++++++++++++++++++++++++-------------
hw/scsi/scsi-bus.c     | 12 +++---
hw/scsi/scsi-disk.c    |  4 +-
softmmu/dma-helpers.c  | 34 +++++++----------
hw/nvram/meson.build   |  6 ++-
hw/rdma/trace-events   |  2 +-
stubs/meson.build      |  4 +-
14 files changed, 134 insertions(+), 92 deletions(-)
[PATCH v2 0/9] hw/dma: Use dma_addr_t type definition when relevant
Posted by Philippe Mathieu-Daudé 2 years, 2 months ago
Since v1:
- Addressed David review comment (stick to dma_addr_t type)
- Addressed Peter review comment (incorrect doc string)

Hi,

This series aims to clarify a bit the DMA API, in particular the
'size' argument which is not clear enough (as we use multiple types
for it). This helps avoiding build failures on 32-bit host [*] (and
likely overflows calculation too IMO).

Some units using the DMA API are first removed from user-mode
emulation to avoid build failure (they shouldn't be there in
the first place).

Then some variables are renamed for clarity (no functional change).

Finally we replace misuses with dma_addr_t typedef. The previous
patch which failed on 32-bit host applied on top (not failing anymore).

Regards,

Phil.

[*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg858825.html

Supersedes: <20211231114901.976937-1-philmd@redhat.com>

Philippe Mathieu-Daudé (9):
  hw/nvram: Restrict stub to sysemu and tools
  hw/pci: Restrict pci-bus stub to sysemu
  hw/pci: Document pci_dma_map()
  hw/dma: Remove CONFIG_USER_ONLY check
  hw/rdma/rdma_utils: Rename rdma_pci_dma_map 'len' argument
  hw/scsi: Rename SCSIRequest::resid as 'residual'
  hw/dma: Fix format string issues using dma_addr_t
  hw/dma: Use dma_addr_t type definition when relevant
  hw/dma: Let dma_buf_read() / dma_buf_write() propagate MemTxResult

 hw/rdma/rdma_utils.h   |  2 +-
 include/hw/pci/pci.h   | 12 ++++++
 include/hw/scsi/scsi.h |  4 +-
 include/sysemu/dma.h   | 31 ++++++++-------
 hw/ide/ahci.c          | 10 ++---
 hw/nvme/ctrl.c         |  6 +--
 hw/rdma/rdma_utils.c   | 14 +++----
 hw/scsi/megasas.c      | 85 +++++++++++++++++++++++++++++-------------
 hw/scsi/scsi-bus.c     | 12 +++---
 hw/scsi/scsi-disk.c    |  4 +-
 softmmu/dma-helpers.c  | 34 +++++++----------
 hw/nvram/meson.build   |  6 ++-
 hw/rdma/trace-events   |  2 +-
 stubs/meson.build      |  4 +-
 14 files changed, 134 insertions(+), 92 deletions(-)

-- 
2.33.1

Re: [PATCH v2 0/9] hw/dma: Use dma_addr_t type definition when relevant
Posted by Michael S. Tsirkin 2 years, 2 months ago
On Tue, Jan 04, 2022 at 09:54:22AM +0100, Philippe Mathieu-Daudé wrote:
> Since v1:
> - Addressed David review comment (stick to dma_addr_t type)
> - Addressed Peter review comment (incorrect doc string)


PCI things:

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

who's merging all this? Yourself?

> Hi,
> 
> This series aims to clarify a bit the DMA API, in particular the
> 'size' argument which is not clear enough (as we use multiple types
> for it). This helps avoiding build failures on 32-bit host [*] (and
> likely overflows calculation too IMO).
> 
> Some units using the DMA API are first removed from user-mode
> emulation to avoid build failure (they shouldn't be there in
> the first place).
> 
> Then some variables are renamed for clarity (no functional change).
> 
> Finally we replace misuses with dma_addr_t typedef. The previous
> patch which failed on 32-bit host applied on top (not failing anymore).
> 
> Regards,
> 
> Phil.
> 
> [*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg858825.html
> 
> Supersedes: <20211231114901.976937-1-philmd@redhat.com>
> 
> Philippe Mathieu-Daudé (9):
>   hw/nvram: Restrict stub to sysemu and tools
>   hw/pci: Restrict pci-bus stub to sysemu
>   hw/pci: Document pci_dma_map()
>   hw/dma: Remove CONFIG_USER_ONLY check
>   hw/rdma/rdma_utils: Rename rdma_pci_dma_map 'len' argument
>   hw/scsi: Rename SCSIRequest::resid as 'residual'
>   hw/dma: Fix format string issues using dma_addr_t
>   hw/dma: Use dma_addr_t type definition when relevant
>   hw/dma: Let dma_buf_read() / dma_buf_write() propagate MemTxResult
> 
>  hw/rdma/rdma_utils.h   |  2 +-
>  include/hw/pci/pci.h   | 12 ++++++
>  include/hw/scsi/scsi.h |  4 +-
>  include/sysemu/dma.h   | 31 ++++++++-------
>  hw/ide/ahci.c          | 10 ++---
>  hw/nvme/ctrl.c         |  6 +--
>  hw/rdma/rdma_utils.c   | 14 +++----
>  hw/scsi/megasas.c      | 85 +++++++++++++++++++++++++++++-------------
>  hw/scsi/scsi-bus.c     | 12 +++---
>  hw/scsi/scsi-disk.c    |  4 +-
>  softmmu/dma-helpers.c  | 34 +++++++----------
>  hw/nvram/meson.build   |  6 ++-
>  hw/rdma/trace-events   |  2 +-
>  stubs/meson.build      |  4 +-
>  14 files changed, 134 insertions(+), 92 deletions(-)
> 
> -- 
> 2.33.1
> 


Re: [PATCH v2 0/9] hw/dma: Use dma_addr_t type definition when relevant
Posted by Philippe Mathieu-Daudé 2 years, 2 months ago
On 1/6/22 12:08, Michael S. Tsirkin wrote:
> On Tue, Jan 04, 2022 at 09:54:22AM +0100, Philippe Mathieu-Daudé wrote:
>> Since v1:
>> - Addressed David review comment (stick to dma_addr_t type)
>> - Addressed Peter review comment (incorrect doc string)
> 
> 
> PCI things:
> 
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

Thanks.

> who's merging all this? Yourself?

I just posted a v3 addressing review comments on this series.
Usually Paolo takes such patches, but I am happy to help sending
PR when this is trivial content (such this series).

Regards,

Phil.