diff options
| author | Steve Sistare <steven.sistare@oracle.com> | 2025-06-10 08:39:21 -0700 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2025-06-11 14:01:58 +0200 |
| commit | eba1f657cbb1b525e2b069626de655da21084e3e (patch) | |
| tree | a37fd5a6dd8a6035395dd3d1abafb81895b98866 /include | |
| parent | dac0dd68d9b150a6aa334ab8ee9aeba011d54b32 (diff) | |
| download | focaccia-qemu-eba1f657cbb1b525e2b069626de655da21084e3e.tar.gz focaccia-qemu-eba1f657cbb1b525e2b069626de655da21084e3e.zip | |
vfio/container: recover from unmap-all-vaddr failure
If there are multiple containers and unmap-all fails for some container, we need to remap vaddr for the other containers for which unmap-all succeeded. Recover by walking all address ranges of all containers to restore the vaddr for each. Do so by invoking the vfio listener callback, and passing a new "remap" flag that tells it to restore a mapping without re-allocating new userland data structures. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/1749569991-25171-9-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/hw/vfio/vfio-container-base.h | 3 | ||||
| -rw-r--r-- | include/hw/vfio/vfio-cpr.h | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-container-base.h index 9d37f86115..f0232654ee 100644 --- a/include/hw/vfio/vfio-container-base.h +++ b/include/hw/vfio/vfio-container-base.h @@ -256,4 +256,7 @@ struct VFIOIOMMUClass { VFIORamDiscardListener *vfio_find_ram_discard_listener( VFIOContainerBase *bcontainer, MemoryRegionSection *section); +void vfio_container_region_add(VFIOContainerBase *bcontainer, + MemoryRegionSection *section, bool cpr_remap); + #endif /* HW_VFIO_VFIO_CONTAINER_BASE_H */ diff --git a/include/hw/vfio/vfio-cpr.h b/include/hw/vfio/vfio-cpr.h index b83dd42751..56ede049ad 100644 --- a/include/hw/vfio/vfio-cpr.h +++ b/include/hw/vfio/vfio-cpr.h @@ -10,6 +10,7 @@ #define HW_VFIO_VFIO_CPR_H #include "migration/misc.h" +#include "system/memory.h" struct VFIOContainer; struct VFIOContainerBase; @@ -17,6 +18,9 @@ struct VFIOGroup; typedef struct VFIOContainerCPR { Error *blocker; + bool vaddr_unmapped; + NotifierWithReturn transfer_notifier; + MemoryListener remap_listener; int (*saved_dma_map)(const struct VFIOContainerBase *bcontainer, hwaddr iova, ram_addr_t size, void *vaddr, bool readonly, MemoryRegion *mr); @@ -42,4 +46,10 @@ int vfio_cpr_group_get_device_fd(int d, const char *name); bool vfio_cpr_container_match(struct VFIOContainer *container, struct VFIOGroup *group, int fd); +void vfio_cpr_giommu_remap(struct VFIOContainerBase *bcontainer, + MemoryRegionSection *section); + +bool vfio_cpr_ram_discard_register_listener( + struct VFIOContainerBase *bcontainer, MemoryRegionSection *section); + #endif /* HW_VFIO_VFIO_CPR_H */ |