diff mbox series

[7/8] hw/dma: Introduce dma_size_t type definition

Message ID 20211231114901.976937-8-philmd@redhat.com
State New
Headers show
Series hw/dma: Introduce dma_size_t type definition | expand

Commit Message

Philippe Mathieu-Daudé Dec. 31, 2021, 11:49 a.m. UTC
The DMA API defines the dma_addr_t type for DMA addresses.
Some sizes related to the API also use this type, which is
a bit confusing when reviewing.

Add a similar 'dma_size_t' definition (and its format string).

Update the obvious places where dma_size_t should be used,
and adapt a pair of format strings.

Move QEMUSGList declaration after dma_size_t definition
so this structure can use the new type.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/rdma/rdma_utils.h      |  4 ++--
 include/hw/pci/pci.h      | 10 ++++----
 include/sysemu/dma.h      | 50 ++++++++++++++++++++-------------------
 hw/ide/ahci.c             |  2 +-
 hw/nvme/ctrl.c            |  2 +-
 hw/nvram/fw_cfg.c         |  2 +-
 hw/rdma/rdma_utils.c      |  6 ++---
 hw/rdma/vmw/pvrdma_main.c |  2 +-
 hw/scsi/lsi53c895a.c      |  4 ++--
 hw/scsi/megasas.c         | 10 ++++----
 hw/usb/libhw.c            |  4 ++--
 softmmu/dma-helpers.c     | 10 ++++----
 hw/rdma/trace-events      |  2 +-
 13 files changed, 55 insertions(+), 53 deletions(-)

Comments

David Hildenbrand Jan. 3, 2022, 10:20 a.m. UTC | #1
>  /*
>   * When an IOMMU is present, bus addresses become distinct from
>   * CPU/memory physical addresses and may be a different size.  Because
> @@ -39,9 +28,22 @@ struct QEMUSGList {
>   * least most) cases.
>   */
>  typedef uint64_t dma_addr_t;
> +typedef uint64_t dma_size_t;

This is a bit inconsistent with other address types (hwaddr,
ram_addr_t), no?

-> git grep "_size_t"

What sticks out are "external" mach_vm_size_t and png_size_t.

To me, it logically makes sense that both types are equal, because we're
operating on the same address space (with the same size).

So at least I don't see the benefit here, but I'd love to be enlightened  :)
Philippe Mathieu-Daudé Jan. 4, 2022, 8:50 a.m. UTC | #2
On Mon, Jan 3, 2022 at 11:22 AM David Hildenbrand <david@redhat.com> wrote:
> >  /*
> >   * When an IOMMU is present, bus addresses become distinct from
> >   * CPU/memory physical addresses and may be a different size.  Because
> > @@ -39,9 +28,22 @@ struct QEMUSGList {
> >   * least most) cases.
> >   */
> >  typedef uint64_t dma_addr_t;
> > +typedef uint64_t dma_size_t;
>
> This is a bit inconsistent with other address types (hwaddr,
> ram_addr_t), no?

Indeed.

> -> git grep "_size_t"
>
> What sticks out are "external" mach_vm_size_t and png_size_t.
>
> To me, it logically makes sense that both types are equal, because we're
> operating on the same address space (with the same size).
>
> So at least I don't see the benefit here, but I'd love to be enlightened  :)

No, you are right, I was not convinced either. I'll stick to dma_addr_t.
diff mbox series

Patch

diff --git a/hw/rdma/rdma_utils.h b/hw/rdma/rdma_utils.h
index 0c6414e7e0a..5446e4e2500 100644
--- a/hw/rdma/rdma_utils.h
+++ b/hw/rdma/rdma_utils.h
@@ -38,8 +38,8 @@  typedef struct RdmaProtectedGSList {
     GSList *list;
 } RdmaProtectedGSList;
 
-void *rdma_pci_dma_map(PCIDevice *dev, dma_addr_t addr, dma_addr_t len);
-void rdma_pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len);
+void *rdma_pci_dma_map(PCIDevice *dev, dma_addr_t addr, dma_size_t len);
+void rdma_pci_dma_unmap(PCIDevice *dev, void *buffer, dma_size_t len);
 void rdma_protected_gqueue_init(RdmaProtectedGQueue *list);
 void rdma_protected_gqueue_destroy(RdmaProtectedGQueue *list);
 void rdma_protected_gqueue_append_int64(RdmaProtectedGQueue *list,
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index f0d707efb8c..f2257b2cd8c 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -805,7 +805,7 @@  static inline AddressSpace *pci_get_address_space(PCIDevice *dev)
  * @dir: indicates the transfer direction
  */
 static inline MemTxResult pci_dma_rw(PCIDevice *dev, dma_addr_t addr,
-                                     void *buf, dma_addr_t len,
+                                     void *buf, dma_size_t len,
                                      DMADirection dir, MemTxAttrs attrs)
 {
     return dma_memory_rw(pci_get_address_space(dev), addr, buf, len,
@@ -825,7 +825,7 @@  static inline MemTxResult pci_dma_rw(PCIDevice *dev, dma_addr_t addr,
  * @len: length of the data transferred
  */
 static inline MemTxResult pci_dma_read(PCIDevice *dev, dma_addr_t addr,
-                                       void *buf, dma_addr_t len)
+                                       void *buf, dma_size_t len)
 {
     return pci_dma_rw(dev, addr, buf, len,
                       DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED);
@@ -844,7 +844,7 @@  static inline MemTxResult pci_dma_read(PCIDevice *dev, dma_addr_t addr,
  * @len: the number of bytes to write
  */
 static inline MemTxResult pci_dma_write(PCIDevice *dev, dma_addr_t addr,
-                                        const void *buf, dma_addr_t len)
+                                        const void *buf, dma_size_t len)
 {
     return pci_dma_rw(dev, addr, (void *) buf, len,
                       DMA_DIRECTION_FROM_DEVICE, MEMTXATTRS_UNSPECIFIED);
@@ -889,7 +889,7 @@  PCI_DMA_DEFINE_LDST(q_be, q_be, 64);
  * @dir: indicates the transfer direction
  */
 static inline void *pci_dma_map(PCIDevice *dev, dma_addr_t addr,
-                                dma_addr_t *plen, DMADirection dir)
+                                dma_size_t *plen, DMADirection dir)
 {
     void *buf;
 
@@ -898,7 +898,7 @@  static inline void *pci_dma_map(PCIDevice *dev, dma_addr_t addr,
     return buf;
 }
 
-static inline void pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len,
+static inline void pci_dma_unmap(PCIDevice *dev, void *buffer, dma_size_t len,
                                  DMADirection dir, dma_addr_t access_len)
 {
     dma_memory_unmap(pci_get_address_space(dev), buffer, len, dir, access_len);
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index 0db2478a506..45a2567848c 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -15,22 +15,11 @@ 
 #include "block/block.h"
 #include "block/accounting.h"
 
-typedef struct ScatterGatherEntry ScatterGatherEntry;
-
 typedef enum {
     DMA_DIRECTION_TO_DEVICE = 0,
     DMA_DIRECTION_FROM_DEVICE = 1,
 } DMADirection;
 
-struct QEMUSGList {
-    ScatterGatherEntry *sg;
-    int nsg;
-    int nalloc;
-    size_t size;
-    DeviceState *dev;
-    AddressSpace *as;
-};
-
 /*
  * When an IOMMU is present, bus addresses become distinct from
  * CPU/memory physical addresses and may be a different size.  Because
@@ -39,9 +28,22 @@  struct QEMUSGList {
  * least most) cases.
  */
 typedef uint64_t dma_addr_t;
+typedef uint64_t dma_size_t;
 
 #define DMA_ADDR_BITS 64
 #define DMA_ADDR_FMT "%" PRIx64
+#define DMA_SIZE_FMT "%" PRIx64
+
+typedef struct ScatterGatherEntry ScatterGatherEntry;
+
+struct QEMUSGList {
+    ScatterGatherEntry *sg;
+    int nsg;
+    int nalloc;
+    dma_size_t size;
+    DeviceState *dev;
+    AddressSpace *as;
+};
 
 static inline void dma_barrier(AddressSpace *as, DMADirection dir)
 {
@@ -70,7 +72,7 @@  static inline void dma_barrier(AddressSpace *as, DMADirection dir)
  * useful for certain cases, but usually you should just use
  * dma_memory_{read,write}() and check for errors */
 static inline bool dma_memory_valid(AddressSpace *as,
-                                    dma_addr_t addr, dma_addr_t len,
+                                    dma_addr_t addr, dma_size_t len,
                                     DMADirection dir, MemTxAttrs attrs)
 {
     return address_space_access_valid(as, addr, len,
@@ -80,7 +82,7 @@  static inline bool dma_memory_valid(AddressSpace *as,
 
 static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as,
                                                 dma_addr_t addr,
-                                                void *buf, dma_addr_t len,
+                                                void *buf, dma_size_t len,
                                                 DMADirection dir,
                                                 MemTxAttrs attrs)
 {
@@ -90,7 +92,7 @@  static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as,
 
 static inline MemTxResult dma_memory_read_relaxed(AddressSpace *as,
                                                   dma_addr_t addr,
-                                                  void *buf, dma_addr_t len)
+                                                  void *buf, dma_size_t len)
 {
     return dma_memory_rw_relaxed(as, addr, buf, len,
                                  DMA_DIRECTION_TO_DEVICE,
@@ -100,7 +102,7 @@  static inline MemTxResult dma_memory_read_relaxed(AddressSpace *as,
 static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as,
                                                    dma_addr_t addr,
                                                    const void *buf,
-                                                   dma_addr_t len)
+                                                   dma_size_t len)
 {
     return dma_memory_rw_relaxed(as, addr, (void *)buf, len,
                                  DMA_DIRECTION_FROM_DEVICE,
@@ -122,7 +124,7 @@  static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as,
  * @attrs: memory transaction attributes
  */
 static inline MemTxResult dma_memory_rw(AddressSpace *as, dma_addr_t addr,
-                                        void *buf, dma_addr_t len,
+                                        void *buf, dma_size_t len,
                                         DMADirection dir, MemTxAttrs attrs)
 {
     dma_barrier(as, dir);
@@ -144,7 +146,7 @@  static inline MemTxResult dma_memory_rw(AddressSpace *as, dma_addr_t addr,
  * @attrs: memory transaction attributes
  */
 static inline MemTxResult dma_memory_read(AddressSpace *as, dma_addr_t addr,
-                                          void *buf, dma_addr_t len,
+                                          void *buf, dma_size_t len,
                                           MemTxAttrs attrs)
 {
     return dma_memory_rw(as, addr, buf, len,
@@ -165,7 +167,7 @@  static inline MemTxResult dma_memory_read(AddressSpace *as, dma_addr_t addr,
  * @attrs: memory transaction attributes
  */
 static inline MemTxResult dma_memory_write(AddressSpace *as, dma_addr_t addr,
-                                           const void *buf, dma_addr_t len,
+                                           const void *buf, dma_size_t len,
                                            MemTxAttrs attrs)
 {
     return dma_memory_rw(as, addr, (void *)buf, len,
@@ -186,7 +188,7 @@  static inline MemTxResult dma_memory_write(AddressSpace *as, dma_addr_t addr,
  * @attrs: memory transaction attributes
  */
 MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr,
-                           uint8_t c, dma_addr_t len, MemTxAttrs attrs);
+                           uint8_t c, dma_size_t len, MemTxAttrs attrs);
 
 /**
  * address_space_map: Map a physical memory region into a host virtual address.
@@ -203,7 +205,7 @@  MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr,
  * @attrs: memory attributes
  */
 static inline void *dma_memory_map(AddressSpace *as,
-                                   dma_addr_t addr, dma_addr_t *len,
+                                   dma_addr_t addr, dma_size_t *len,
                                    DMADirection dir, MemTxAttrs attrs)
 {
     hwaddr xlen = *len;
@@ -230,8 +232,8 @@  static inline void *dma_memory_map(AddressSpace *as,
  * @access_len: amount of data actually transferred
  */
 static inline void dma_memory_unmap(AddressSpace *as,
-                                    void *buffer, dma_addr_t len,
-                                    DMADirection dir, dma_addr_t access_len)
+                                    void *buffer, dma_size_t len,
+                                    DMADirection dir, dma_size_t access_len)
 {
     address_space_unmap(as, buffer, (hwaddr)len,
                         dir == DMA_DIRECTION_FROM_DEVICE, access_len);
@@ -279,12 +281,12 @@  DEFINE_LDST_DMA(q, q, 64, be);
 
 struct ScatterGatherEntry {
     dma_addr_t base;
-    dma_addr_t len;
+    dma_size_t len;
 };
 
 void qemu_sglist_init(QEMUSGList *qsg, DeviceState *dev, int alloc_hint,
                       AddressSpace *as);
-void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len);
+void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_size_t len);
 void qemu_sglist_destroy(QEMUSGList *qsg);
 
 typedef BlockAIOCB *DMAIOFunc(int64_t offset, QEMUIOVector *iov,
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 205dfdc6622..256bbc377ce 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1159,7 +1159,7 @@  static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
     ahci_populate_sglist(ad, &ncq_tfs->sglist, ncq_tfs->cmdh, size, 0);
 
     if (ncq_tfs->sglist.size < size) {
-        error_report("ahci: PRDT length for NCQ command (0x%zx) "
+        error_report("ahci: PRDT length for NCQ command (0x" DMA_SIZE_FMT ") "
                      "is smaller than the requested size (0x%zx)",
                      ncq_tfs->sglist.size, size);
         ncq_err(ncq_tfs);
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 462f79a1f60..4620e662fc9 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1147,7 +1147,7 @@  static uint16_t nvme_tx(NvmeCtrl *n, NvmeSg *sg, uint8_t *ptr, uint32_t len,
 
     if (sg->flags & NVME_SG_DMA) {
         const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
-        uint64_t residual;
+        dma_size_t residual;
 
         if (dir == NVME_TX_DIRECTION_TO_DEVICE) {
             residual = dma_buf_write(ptr, len, &sg->qsg, attrs);
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index e5f3c981841..a30bff8a14a 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -346,12 +346,12 @@  static void fw_cfg_data_mem_write(void *opaque, hwaddr addr,
 
 static void fw_cfg_dma_transfer(FWCfgState *s)
 {
-    dma_addr_t len;
     FWCfgDmaAccess dma;
     int arch;
     FWCfgEntry *e;
     int read = 0, write = 0;
     dma_addr_t dma_addr;
+    dma_size_t len;
 
     /* Reset the address before the next access */
     dma_addr = s->dma_addr;
diff --git a/hw/rdma/rdma_utils.c b/hw/rdma/rdma_utils.c
index 61cb8ede0fd..677d7ffba53 100644
--- a/hw/rdma/rdma_utils.c
+++ b/hw/rdma/rdma_utils.c
@@ -17,10 +17,10 @@ 
 #include "trace.h"
 #include "rdma_utils.h"
 
-void *rdma_pci_dma_map(PCIDevice *dev, dma_addr_t addr, dma_addr_t len)
+void *rdma_pci_dma_map(PCIDevice *dev, dma_addr_t addr, dma_size_t len)
 {
     void *p;
-    hwaddr pci_len = len;
+    dma_size_t pci_len = len;
 
     if (!addr) {
         rdma_error_report("addr is NULL");
@@ -44,7 +44,7 @@  void *rdma_pci_dma_map(PCIDevice *dev, dma_addr_t addr, dma_addr_t len)
     return p;
 }
 
-void rdma_pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len)
+void rdma_pci_dma_unmap(PCIDevice *dev, void *buffer, dma_size_t len)
 {
     trace_rdma_pci_dma_unmap(buffer);
     if (buffer) {
diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
index 91206dbb8eb..bf3d542302e 100644
--- a/hw/rdma/vmw/pvrdma_main.c
+++ b/hw/rdma/vmw/pvrdma_main.c
@@ -124,7 +124,7 @@  static int init_dev_ring(PvrdmaRing *ring, PvrdmaRingState **ring_state,
                           (num_pages - 1) * TARGET_PAGE_SIZE /
                           sizeof(struct pvrdma_cqne),
                           sizeof(struct pvrdma_cqne),
-                          (dma_addr_t *)&tbl[1], (dma_addr_t)num_pages - 1);
+                          (dma_addr_t *)&tbl[1], (dma_size_t)num_pages - 1);
     if (rc) {
         rc = -ENOMEM;
         goto out_free_ring_state;
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 4c431adb774..6d63bffc804 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -444,7 +444,7 @@  static void lsi_execute_script(LSIState *s);
 static void lsi_reselect(LSIState *s, lsi_request *p);
 
 static inline void lsi_mem_read(LSIState *s, dma_addr_t addr,
-                               void *buf, dma_addr_t len)
+                                void *buf, dma_size_t len)
 {
     if (s->dmode & LSI_DMODE_SIOM) {
         address_space_read(&s->pci_io_as, addr, MEMTXATTRS_UNSPECIFIED,
@@ -455,7 +455,7 @@  static inline void lsi_mem_read(LSIState *s, dma_addr_t addr,
 }
 
 static inline void lsi_mem_write(LSIState *s, dma_addr_t addr,
-                                const void *buf, dma_addr_t len)
+                                 const void *buf, dma_size_t len)
 {
     if (s->dmode & LSI_DMODE_DIOM) {
         address_space_write(&s->pci_io_as, addr, MEMTXATTRS_UNSPECIFIED,
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index cb019549371..7456a25970a 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -1046,7 +1046,7 @@  static int megasas_pd_get_info_submit(SCSIDevice *sdev, int lun,
     uint16_t pd_id = ((sdev->id & 0xFF) << 8) | (lun & 0xFF);
     uint8_t cmdbuf[6];
     size_t len;
-    size_t residual;
+    dma_size_t residual;
 
     if (!cmd->iov_buf) {
         cmd->iov_buf = g_malloc0(dcmd_size);
@@ -1152,7 +1152,7 @@  static int megasas_dcmd_ld_get_list(MegasasState *s, MegasasCmd *cmd)
 {
     struct mfi_ld_list info;
     size_t dcmd_size = sizeof(info);
-    size_t residual;
+    dma_size_t residual;
     uint32_t num_ld_disks = 0, max_ld_disks;
     uint64_t ld_size;
     BusChild *kid;
@@ -1198,7 +1198,7 @@  static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
     uint16_t flags;
     struct mfi_ld_targetid_list info;
     size_t dcmd_size = sizeof(info);
-    size_t residual;
+    dma_size_t residual;
     uint32_t num_ld_disks = 0, max_ld_disks = s->fw_luns;
     BusChild *kid;
 
@@ -1251,7 +1251,7 @@  static int megasas_ld_get_info_submit(SCSIDevice *sdev, int lun,
     size_t dcmd_size = sizeof(struct mfi_ld_info);
     uint8_t cdb[6];
     ssize_t len;
-    size_t residual;
+    dma_size_t residual;
     uint16_t sdev_id = ((sdev->id & 0xFF) << 8) | (lun & 0xFF);
     uint64_t ld_size;
 
@@ -1625,7 +1625,7 @@  static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)
 }
 
 static int megasas_finish_internal_dcmd(MegasasCmd *cmd,
-                                        SCSIRequest *req, size_t residual)
+                                        SCSIRequest *req, dma_size_t residual)
 {
     int retval = MFI_STAT_OK;
     int lun = req->lun;
diff --git a/hw/usb/libhw.c b/hw/usb/libhw.c
index f350eae443d..f632258459a 100644
--- a/hw/usb/libhw.c
+++ b/hw/usb/libhw.c
@@ -32,10 +32,10 @@  int usb_packet_map(USBPacket *p, QEMUSGList *sgl)
 
     for (i = 0; i < sgl->nsg; i++) {
         dma_addr_t base = sgl->sg[i].base;
-        dma_addr_t len = sgl->sg[i].len;
+        dma_size_t len = sgl->sg[i].len;
 
         while (len) {
-            dma_addr_t xlen = len;
+            dma_size_t xlen = len;
             mem = dma_memory_map(sgl->as, base, &xlen, dir,
                                  MEMTXATTRS_UNSPECIFIED);
             if (!mem) {
diff --git a/softmmu/dma-helpers.c b/softmmu/dma-helpers.c
index 4563a775aa7..66ba0b2c361 100644
--- a/softmmu/dma-helpers.c
+++ b/softmmu/dma-helpers.c
@@ -19,7 +19,7 @@ 
 /* #define DEBUG_IOMMU */
 
 MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr,
-                           uint8_t c, dma_addr_t len, MemTxAttrs attrs)
+                           uint8_t c, dma_size_t len, MemTxAttrs attrs)
 {
     dma_barrier(as, DMA_DIRECTION_FROM_DEVICE);
 
@@ -51,7 +51,7 @@  void qemu_sglist_init(QEMUSGList *qsg, DeviceState *dev, int alloc_hint,
     object_ref(OBJECT(dev));
 }
 
-void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len)
+void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_size_t len)
 {
     if (qsg->nsg == qsg->nalloc) {
         qsg->nalloc = 2 * qsg->nalloc + 1;
@@ -294,12 +294,12 @@  BlockAIOCB *dma_blk_write(BlockBackend *blk,
 }
 
 
-static MemTxResult dma_buf_rw(void *buf, int32_t len, uint64_t *residual,
+static MemTxResult dma_buf_rw(void *buf, dma_size_t len, dma_size_t *residual,
                               QEMUSGList *sg, DMADirection dir,
                               MemTxAttrs attrs)
 {
     uint8_t *ptr = buf;
-    uint64_t xresidual;
+    dma_size_t xresidual;
     int sg_cur_index;
     MemTxResult res = MEMTX_OK;
 
@@ -308,7 +308,7 @@  static MemTxResult dma_buf_rw(void *buf, int32_t len, uint64_t *residual,
     len = MIN(len, xresidual);
     while (len > 0) {
         ScatterGatherEntry entry = sg->sg[sg_cur_index++];
-        int32_t xfer = MIN(len, entry.len);
+        dma_size_t xfer = MIN(len, entry.len);
         res |= dma_memory_rw(sg->as, entry.base, ptr, xfer, dir, attrs);
         ptr += xfer;
         len -= xfer;
diff --git a/hw/rdma/trace-events b/hw/rdma/trace-events
index 9accb149734..c23175120e1 100644
--- a/hw/rdma/trace-events
+++ b/hw/rdma/trace-events
@@ -27,5 +27,5 @@  rdma_rm_alloc_qp(uint32_t rm_qpn, uint32_t backend_qpn, uint8_t qp_type) "rm_qpn
 rdma_rm_modify_qp(uint32_t qpn, uint32_t attr_mask, int qp_state, uint8_t sgid_idx) "qpn=0x%x, attr_mask=0x%x, qp_state=%d, sgid_idx=%d"
 
 # rdma_utils.c
-rdma_pci_dma_map(uint64_t addr, void *vaddr, uint64_t len) "0x%"PRIx64" -> %p (len=%" PRId64")"
+rdma_pci_dma_map(uint64_t addr, void *vaddr, uint64_t len) "0x%"PRIx64" -> %p (len=%" PRIu64")"
 rdma_pci_dma_unmap(void *vaddr) "%p"