[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 02/15] util: vfio-helpers: Remove Error parameter from qemu_vf
From: |
David Hildenbrand |
Subject: |
[PATCH v3 02/15] util: vfio-helpers: Remove Error parameter from qemu_vfio_undo_mapping() |
Date: |
Thu, 27 Feb 2020 11:11:52 +0100 |
Everybody discards the error. Let's error_report() instead so this error
doesn't get lost.
This is now the same error handling as in qemu_vfio_do_mapping(). However,
we don't report any errors via the return value to the caller. This seems
to be one of these "will never happen, but let's better print an error
because the caller can't handle it either way" cases.
Cc: Richard Henderson <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Marcel Apfelbaum <address@hidden>
Cc: Alex Williamson <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
util/vfio-helpers.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index f31aa77ffe..7085ca702c 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -541,8 +541,7 @@ static int qemu_vfio_do_mapping(QEMUVFIOState *s, void
*host, size_t size,
/**
* Undo the DMA mapping from @s with VFIO, and remove from mapping list.
*/
-static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IOVAMapping *mapping,
- Error **errp)
+static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IOVAMapping *mapping)
{
int index;
struct vfio_iommu_type1_dma_unmap unmap = {
@@ -557,7 +556,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s,
IOVAMapping *mapping,
assert(QEMU_IS_ALIGNED(mapping->size, qemu_real_host_page_size));
assert(index >= 0 && index < s->nr_mappings);
if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) {
- error_setg_errno(errp, errno, "VFIO_UNMAP_DMA failed");
+ error_report("VFIO_UNMAP_DMA failed: %s", strerror(errno));
}
memmove(mapping, &s->mappings[index + 1],
sizeof(s->mappings[0]) * (s->nr_mappings - index - 1));
@@ -622,7 +621,7 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, size_t
size,
assert(qemu_vfio_verify_mappings(s));
ret = qemu_vfio_do_mapping(s, host, size, iova0);
if (ret) {
- qemu_vfio_undo_mapping(s, mapping, NULL);
+ qemu_vfio_undo_mapping(s, mapping);
goto out;
}
s->low_water_mark += size;
@@ -682,7 +681,7 @@ void qemu_vfio_dma_unmap(QEMUVFIOState *s, void *host)
if (!m) {
goto out;
}
- qemu_vfio_undo_mapping(s, m, NULL);
+ qemu_vfio_undo_mapping(s, m);
out:
qemu_mutex_unlock(&s->lock);
}
@@ -699,7 +698,7 @@ void qemu_vfio_close(QEMUVFIOState *s)
return;
}
while (s->nr_mappings) {
- qemu_vfio_undo_mapping(s, &s->mappings[s->nr_mappings - 1], NULL);
+ qemu_vfio_undo_mapping(s, &s->mappings[s->nr_mappings - 1]);
}
ram_block_notifier_remove(&s->ram_notifier);
qemu_vfio_reset(s);
--
2.24.1
- [PATCH v3 00/15] Ram blocks with resizeable anonymous allocations under POSIX, David Hildenbrand, 2020/02/27
- [PATCH v3 01/15] util: vfio-helpers: Fix qemu_vfio_close(), David Hildenbrand, 2020/02/27
- [PATCH v3 02/15] util: vfio-helpers: Remove Error parameter from qemu_vfio_undo_mapping(),
David Hildenbrand <=
- [PATCH v3 03/15] util: vfio-helpers: Factor out removal from qemu_vfio_undo_mapping(), David Hildenbrand, 2020/02/27
- [PATCH v3 04/15] exec: Factor out setting ram settings (madvise ...) into qemu_ram_apply_settings(), David Hildenbrand, 2020/02/27
- [PATCH v3 05/15] exec: Reuse qemu_ram_apply_settings() in qemu_ram_remap(), David Hildenbrand, 2020/02/27
- [PATCH v3 06/15] exec: Drop "shared" parameter from ram_block_add(), David Hildenbrand, 2020/02/27
- [PATCH v3 07/15] util/mmap-alloc: Factor out calculation of the pagesize for the guard page, David Hildenbrand, 2020/02/27
- [PATCH v3 08/15] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve(), David Hildenbrand, 2020/02/27
- [PATCH v3 09/15] util/mmap-alloc: Factor out populating of memory to mmap_populate(), David Hildenbrand, 2020/02/27
- [PATCH v3 10/15] util/mmap-alloc: Prepare for resizeable mmaps, David Hildenbrand, 2020/02/27
- [PATCH v3 11/15] util/mmap-alloc: Implement resizeable mmaps, David Hildenbrand, 2020/02/27