[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 2/6] vfio/common: Handle memory_region_register_i
From: |
Eric Auger |
Subject: |
[Qemu-devel] [PATCH v1 2/6] vfio/common: Handle memory_region_register_iommu_notifier() failure |
Date: |
Fri, 13 Sep 2019 10:36:11 +0200 |
Now memory_region_register_iommu_notifier() is allowed to fail,
let's handle the returned value in vfio_listener_region_add().
This will allow to remove the error handling (exit) in the
IOMMUs that implement a notify_flag_changed() that sometimes
cannot accept the MAP flag.
Signed-off-by: Eric Auger <address@hidden>
---
hw/vfio/common.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 3e03c495d8..d57d72cfb9 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -630,9 +630,13 @@ static void vfio_listener_region_add(MemoryListener
*listener,
section->offset_within_region,
int128_get64(llend),
iommu_idx);
- QLIST_INSERT_HEAD(&container->giommu_list, giommu, giommu_next);
- memory_region_register_iommu_notifier(section->mr, &giommu->n);
+ ret = memory_region_register_iommu_notifier(section->mr, &giommu->n);
+ if (ret) {
+ g_free(giommu);
+ goto fail;
+ }
+ QLIST_INSERT_HEAD(&container->giommu_list, giommu, giommu_next);
memory_region_iommu_replay(giommu->iommu, &giommu->n);
return;
--
2.20.1
- [Qemu-devel] [PATCH v1 0/6] Allow memory_region_register_iommu_notifier() to fail, Eric Auger, 2019/09/13
- [Qemu-devel] [PATCH v1 1/6] memory: allow memory_region_register_iommu_notifier() to fail, Eric Auger, 2019/09/13
- [Qemu-devel] [PATCH v1 2/6] vfio/common: Handle memory_region_register_iommu_notifier() failure,
Eric Auger <=
- [Qemu-devel] [PATCH v1 3/6] exec: assert on memory_region_register_iommu_notifier() failure, Eric Auger, 2019/09/13
- [Qemu-devel] [PATCH v1 4/6] vhost: assert on memory_region_register_iommu_notifier() failure, Eric Auger, 2019/09/13
- [Qemu-devel] [PATCH v1 5/6] intel_iommu: Let vtd_iommu_notify_flag_changed() fail, Eric Auger, 2019/09/13
- [Qemu-devel] [PATCH v1 6/6] amd_iommu: Let amdvi_iommu_notify_flag_changed() fail, Eric Auger, 2019/09/13