On 30/9/25 10:53, Cédric Le Goater wrote:
On 9/29/25 18:08, Philippe Mathieu-Daudé wrote:
The 'ram_addr_t' type is described as:

   a QEMU internal address space that maps guest RAM physical
   addresses into an intermediate address space that can map
   to host virtual address spaces.

This doesn't represent well an IOVA mapping size. Simply use
the uint64_t type.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  include/hw/vfio/vfio-container.h | 10 +++++-----
  hw/vfio-user/container.c         |  4 ++--
  hw/vfio/container-legacy.c       |  8 ++++----
  hw/vfio/container.c              |  5 ++---
  hw/vfio/iommufd.c                |  6 +++---
  5 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio- container.h
index 093c360f0ee..c4b58d664b7 100644
--- a/include/hw/vfio/vfio-container.h
+++ b/include/hw/vfio/vfio-container.h
@@ -81,10 +81,10 @@ void vfio_address_space_insert(VFIOAddressSpace *space,
                                 VFIOContainer *bcontainer);
  int vfio_container_dma_map(VFIOContainer *bcontainer,
-                           hwaddr iova, ram_addr_t size,
+                           hwaddr iova, uint64_t size,
                             void *vaddr, bool readonly, MemoryRegion *mr);
  int vfio_container_dma_unmap(VFIOContainer *bcontainer,
-                             hwaddr iova, ram_addr_t size,
+                             hwaddr iova, uint64_t size,
                               IOMMUTLBEntry *iotlb, bool unmap_all);
  bool vfio_container_add_section_window(VFIOContainer *bcontainer,
                                         MemoryRegionSection *section,
@@ -167,7 +167,7 @@ struct VFIOIOMMUClass {
       * Returns 0 to indicate success and -errno otherwise.
       */
      int (*dma_map)(const VFIOContainer *bcontainer,
-                   hwaddr iova, ram_addr_t size,
+                   hwaddr iova, uint64_t size,
                     void *vaddr, bool readonly, MemoryRegion *mr);
      /**
       * @dma_map_file
@@ -182,7 +182,7 @@ struct VFIOIOMMUClass {
       * @readonly: map read only if true
       */
      int (*dma_map_file)(const VFIOContainer *bcontainer,
-                        hwaddr iova, ram_addr_t size,
+                        hwaddr iova, uint64_t size,
                          int fd, unsigned long start, bool readonly);


Don't forget to change :

typedef int (*dma_map_fn)(const struct VFIOContainer *bcontainer,
                           hwaddr iova, ram_addr_t size, void *vaddr,
                           bool readonly, MemoryRegion *mr);

in /include/hw/vfio/vfio-cpr.h.

Odd place to declare a typedef aiming to match a prototype of
another header. No common vfio header between vfio-cpr.h and
vfio-container.h?

Reply via email to