[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/47] vfio/container: Move dirty_pgsizes and max_dirty_bitmap_siz
From: |
Cédric Le Goater |
Subject: |
[PULL 13/47] vfio/container: Move dirty_pgsizes and max_dirty_bitmap_size to base container |
Date: |
Tue, 19 Dec 2023 19:56:09 +0100 |
From: Eric Auger <eric.auger@redhat.com>
No functional change intended.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/vfio/vfio-common.h | 2 --
include/hw/vfio/vfio-container-base.h | 2 ++
hw/vfio/container.c | 9 +++++----
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index
922022cbc6c69ddb39c7241fc983b959be566d33..b1c9fe711bb9cb661ca036214a63bb1607e956a3
100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -80,8 +80,6 @@ typedef struct VFIOContainer {
int fd; /* /dev/vfio/vfio, empowered by the attached groups */
MemoryListener prereg_listener;
unsigned iommu_type;
- uint64_t dirty_pgsizes;
- uint64_t max_dirty_bitmap_size;
QLIST_HEAD(, VFIOHostDMAWindow) hostwin_list;
QLIST_HEAD(, VFIOGroup) group_list;
GList *iova_ranges;
diff --git a/include/hw/vfio/vfio-container-base.h
b/include/hw/vfio/vfio-container-base.h
index
95f8d319e0c6cf490a3e92dbf1735ad12b53fc65..80e4a993c5cfbceb9ab8366eae4ba5bafe26b208
100644
--- a/include/hw/vfio/vfio-container-base.h
+++ b/include/hw/vfio/vfio-container-base.h
@@ -39,6 +39,8 @@ typedef struct VFIOContainerBase {
MemoryListener listener;
Error *error;
bool initialized;
+ uint64_t dirty_pgsizes;
+ uint64_t max_dirty_bitmap_size;
unsigned long pgsizes;
unsigned int dma_max_mappings;
bool dirty_pages_supported;
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index
5c1dee8c9f889fb6746449fe4fe611289cb247db..c8088a8174f18e58c6704e09cf9a7c09a0124175
100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -64,6 +64,7 @@ static int vfio_dma_unmap_bitmap(VFIOContainer *container,
hwaddr iova, ram_addr_t size,
IOMMUTLBEntry *iotlb)
{
+ VFIOContainerBase *bcontainer = &container->bcontainer;
struct vfio_iommu_type1_dma_unmap *unmap;
struct vfio_bitmap *bitmap;
VFIOBitmap vbmap;
@@ -91,7 +92,7 @@ static int vfio_dma_unmap_bitmap(VFIOContainer *container,
bitmap->size = vbmap.size;
bitmap->data = (__u64 *)vbmap.bitmap;
- if (vbmap.size > container->max_dirty_bitmap_size) {
+ if (vbmap.size > bcontainer->max_dirty_bitmap_size) {
error_report("UNMAP: Size of bitmap too big 0x%"PRIx64, vbmap.size);
ret = -E2BIG;
goto unmap_exit;
@@ -131,7 +132,7 @@ static int vfio_legacy_dma_unmap(VFIOContainerBase
*bcontainer, hwaddr iova,
if (iotlb && vfio_devices_all_running_and_mig_active(bcontainer)) {
if (!vfio_devices_all_device_dirty_tracking(bcontainer) &&
- container->bcontainer.dirty_pages_supported) {
+ bcontainer->dirty_pages_supported) {
return vfio_dma_unmap_bitmap(container, iova, size, iotlb);
}
@@ -469,8 +470,8 @@ static void vfio_get_iommu_info_migration(VFIOContainer
*container,
*/
if (cap_mig->pgsize_bitmap & qemu_real_host_page_size()) {
bcontainer->dirty_pages_supported = true;
- container->max_dirty_bitmap_size = cap_mig->max_dirty_bitmap_size;
- container->dirty_pgsizes = cap_mig->pgsize_bitmap;
+ bcontainer->max_dirty_bitmap_size = cap_mig->max_dirty_bitmap_size;
+ bcontainer->dirty_pgsizes = cap_mig->pgsize_bitmap;
}
}
--
2.43.0
- [PULL 04/47] vfio/common: Introduce vfio_container_init/destroy helper, (continued)
- [PULL 04/47] vfio/common: Introduce vfio_container_init/destroy helper, Cédric Le Goater, 2023/12/19
- [PULL 03/47] vfio/container: Switch to dma_map|unmap API, Cédric Le Goater, 2023/12/19
- [PULL 05/47] vfio/common: Move giommu_list in base container, Cédric Le Goater, 2023/12/19
- [PULL 06/47] vfio/container: Move space field to base container, Cédric Le Goater, 2023/12/19
- [PULL 07/47] vfio/container: Switch to IOMMU BE set_dirty_page_tracking/query_dirty_bitmap API, Cédric Le Goater, 2023/12/19
- [PULL 08/47] vfio/container: Move per container device list in base container, Cédric Le Goater, 2023/12/19
- [PULL 09/47] vfio/container: Convert functions to base container, Cédric Le Goater, 2023/12/19
- [PULL 10/47] vfio/container: Move pgsizes and dma_max_mappings to base container, Cédric Le Goater, 2023/12/19
- [PULL 11/47] vfio/container: Move vrdl_list to base container, Cédric Le Goater, 2023/12/19
- [PULL 12/47] vfio/container: Move listener to base container, Cédric Le Goater, 2023/12/19
- [PULL 13/47] vfio/container: Move dirty_pgsizes and max_dirty_bitmap_size to base container,
Cédric Le Goater <=
- [PULL 14/47] vfio/container: Move iova_ranges to base container, Cédric Le Goater, 2023/12/19
- [PULL 16/47] vfio/spapr: Introduce spapr backend and target interface, Cédric Le Goater, 2023/12/19
- [PULL 17/47] vfio/spapr: switch to spapr IOMMU BE add/del_section_window, Cédric Le Goater, 2023/12/19
- [PULL 18/47] vfio/spapr: Move prereg_listener into spapr container, Cédric Le Goater, 2023/12/19
- [PULL 15/47] vfio/container: Implement attach/detach_device, Cédric Le Goater, 2023/12/19
- [PULL 19/47] vfio/spapr: Move hostwin_list into spapr container, Cédric Le Goater, 2023/12/19
- [PULL 21/47] util/char_dev: Add open_cdev(), Cédric Le Goater, 2023/12/19
- [PULL 20/47] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/12/19