From: "Cédric Le Goater" <clg@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Yi Liu <yi.l.liu@intel.com>,
Thanos Makatos <thanos.makatos@nutanix.com>,
John Levon <john.levon@nutanix.com>,
Alex Williamson <alex.williamson@redhat.com>,
Eric Auger <eric.auger@redhat.com>,
Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: Re: [PATCH 3/3] hw/vfio: Use uint64_t for IOVA mapping size in vfio_container_dma_*map
Date: Tue, 30 Sep 2025 10:48:22 +0200 [thread overview]
Message-ID: <75040958-036d-4364-bff0-730bac8a01f2@redhat.com> (raw)
In-Reply-To: <20250929160807.73626-4-philmd@linaro.org>
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é <philmd@linaro.org>
> ---
> 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);
> /**
> * @dma_unmap
> @@ -198,7 +198,7 @@ struct VFIOIOMMUClass {
> * Returns 0 to indicate success and -errno otherwise.
> */
> int (*dma_unmap)(const VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> IOMMUTLBEntry *iotlb, bool unmap_all);
>
>
> diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
> index 411eb7b28b7..e45192fef65 100644
> --- a/hw/vfio-user/container.c
> +++ b/hw/vfio-user/container.c
> @@ -39,7 +39,7 @@ static void vfio_user_listener_commit(VFIOContainer *bcontainer)
> }
>
> static int vfio_user_dma_unmap(const VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> IOMMUTLBEntry *iotlb, bool unmap_all)
> {
> VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
> @@ -81,7 +81,7 @@ static int vfio_user_dma_unmap(const VFIOContainer *bcontainer,
> }
>
> static int vfio_user_dma_map(const VFIOContainer *bcontainer, hwaddr iova,
> - ram_addr_t size, void *vaddr, bool readonly,
> + uint64_t size, void *vaddr, bool readonly,
> MemoryRegion *mrp)
> {
> VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
> diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c
> index c0f87f774a0..3a710d8265c 100644
> --- a/hw/vfio/container-legacy.c
> +++ b/hw/vfio/container-legacy.c
> @@ -69,7 +69,7 @@ static int vfio_ram_block_discard_disable(VFIOLegacyContainer *container,
> }
>
> static int vfio_dma_unmap_bitmap(const VFIOLegacyContainer *container,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> IOMMUTLBEntry *iotlb)
> {
> const VFIOContainer *bcontainer = VFIO_IOMMU(container);
> @@ -122,7 +122,7 @@ unmap_exit:
> }
>
> static int vfio_legacy_dma_unmap_one(const VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> IOMMUTLBEntry *iotlb)
> {
> const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
> @@ -185,7 +185,7 @@ static int vfio_legacy_dma_unmap_one(const VFIOContainer *bcontainer,
> * DMA - Mapping and unmapping for the "type1" IOMMU interface used on x86
> */
> static int vfio_legacy_dma_unmap(const VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> IOMMUTLBEntry *iotlb, bool unmap_all)
> {
> int ret;
> @@ -210,7 +210,7 @@ static int vfio_legacy_dma_unmap(const VFIOContainer *bcontainer,
> }
>
> static int vfio_legacy_dma_map(const VFIOContainer *bcontainer, hwaddr iova,
> - ram_addr_t size, void *vaddr, bool readonly,
> + uint64_t size, void *vaddr, bool readonly,
> MemoryRegion *mr)
> {
> const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
> diff --git a/hw/vfio/container.c b/hw/vfio/container.c
> index 9d694393714..b5af3ac174c 100644
> --- a/hw/vfio/container.c
> +++ b/hw/vfio/container.c
> @@ -15,7 +15,6 @@
>
> #include "qemu/osdep.h"
> #include "system/tcg.h"
> -#include "system/ram_addr.h"
This is required for cpu_physical_memory_set_dirty_range()
C.
> #include "qapi/error.h"
> #include "qemu/error-report.h"
> #include "hw/vfio/vfio-container.h"
> @@ -74,7 +73,7 @@ void vfio_address_space_insert(VFIOAddressSpace *space,
> }
>
> int vfio_container_dma_map(VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> void *vaddr, bool readonly, MemoryRegion *mr)
> {
> VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
> @@ -93,7 +92,7 @@ int vfio_container_dma_map(VFIOContainer *bcontainer,
> }
>
> int vfio_container_dma_unmap(VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> IOMMUTLBEntry *iotlb, bool unmap_all)
> {
> VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
> diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
> index f0ffe235919..68470d552ec 100644
> --- a/hw/vfio/iommufd.c
> +++ b/hw/vfio/iommufd.c
> @@ -35,7 +35,7 @@
> TYPE_HOST_IOMMU_DEVICE_IOMMUFD "-vfio"
>
> static int iommufd_cdev_map(const VFIOContainer *bcontainer, hwaddr iova,
> - ram_addr_t size, void *vaddr, bool readonly,
> + uint64_t size, void *vaddr, bool readonly,
> MemoryRegion *mr)
> {
> const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
> @@ -46,7 +46,7 @@ static int iommufd_cdev_map(const VFIOContainer *bcontainer, hwaddr iova,
> }
>
> static int iommufd_cdev_map_file(const VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> int fd, unsigned long start, bool readonly)
> {
> const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
> @@ -57,7 +57,7 @@ static int iommufd_cdev_map_file(const VFIOContainer *bcontainer,
> }
>
> static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,
> - hwaddr iova, ram_addr_t size,
> + hwaddr iova, uint64_t size,
> IOMMUTLBEntry *iotlb, bool unmap_all)
> {
> const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
next prev parent reply other threads:[~2025-09-30 8:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 16:08 [PATCH 0/3] hw/vfio: Remove invalid uses of ram_addr_t type Philippe Mathieu-Daudé
2025-09-29 16:08 ` [PATCH 1/3] system/iommufd: Use uint64_t type for IOVA mapping size Philippe Mathieu-Daudé
2025-09-29 16:08 ` [PATCH 2/3] hw/vfio: Avoid ram_addr_t in vfio_container_query_dirty_bitmap() Philippe Mathieu-Daudé
2025-09-29 16:08 ` [PATCH 3/3] hw/vfio: Use uint64_t for IOVA mapping size in vfio_container_dma_*map Philippe Mathieu-Daudé
2025-09-30 8:46 ` Philippe Mathieu-Daudé
2025-09-30 8:48 ` Cédric Le Goater [this message]
2025-09-30 8:53 ` Cédric Le Goater
2025-09-30 9:08 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75040958-036d-4364-bff0-730bac8a01f2@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=eric.auger@redhat.com \
--cc=john.levon@nutanix.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thanos.makatos@nutanix.com \
--cc=yi.l.liu@intel.com \
--cc=zhenzhong.duan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).