[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/41] kvm: consistently return 0/-errno from kvm_convert_memory
From: |
Paolo Bonzini |
Subject: |
[PULL 33/41] kvm: consistently return 0/-errno from kvm_convert_memory |
Date: |
Thu, 19 Dec 2024 09:32:20 +0100 |
In case of incorrect parameters, kvm_convert_memory() was returning
-1 instead of -EINVAL. The guest won't notice because it will move
anyway to RUN_STATE_INTERNAL_ERROR, but fix this for consistency and
clarity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
accel/kvm/kvm-all.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 801cff16a5a..77d811ca70c 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2999,17 +2999,17 @@ int kvm_convert_memory(hwaddr start, hwaddr size, bool
to_private)
MemoryRegion *mr;
RAMBlock *rb;
void *addr;
- int ret = -1;
+ int ret = -EINVAL;
trace_kvm_convert_memory(start, size, to_private ? "shared_to_private" :
"private_to_shared");
if (!QEMU_PTR_IS_ALIGNED(start, qemu_real_host_page_size()) ||
!QEMU_PTR_IS_ALIGNED(size, qemu_real_host_page_size())) {
- return -1;
+ return ret;
}
if (!size) {
- return -1;
+ return ret;
}
section = memory_region_find(get_system_memory(), start, size);
@@ -3027,7 +3027,7 @@ int kvm_convert_memory(hwaddr start, hwaddr size, bool
to_private)
if (!to_private) {
return 0;
}
- return -1;
+ return ret;
}
if (!memory_region_has_guest_memfd(mr)) {
--
2.47.1
- [PULL 23/41] hw/core/qdev-properties: Constify Property argument to PropertyInfo.print, (continued)
- [PULL 23/41] hw/core/qdev-properties: Constify Property argument to PropertyInfo.print, Paolo Bonzini, 2024/12/19
- [PULL 24/41] Constify all opaque Property pointers, Paolo Bonzini, 2024/12/19
- [PULL 20/41] include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST, Paolo Bonzini, 2024/12/19
- [PULL 26/41] rust: qom: add possibility of overriding unparent, Paolo Bonzini, 2024/12/19
- [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Paolo Bonzini, 2024/12/19
- [PULL 27/41] rust: rename qemu-api modules to follow C code a bit more, Paolo Bonzini, 2024/12/19
- [PULL 28/41] rust: re-export C types from qemu-api submodules, Paolo Bonzini, 2024/12/19
- [PULL 29/41] rust: tests: allow writing more than one test, Paolo Bonzini, 2024/12/19
- [PULL 30/41] rust: qom: add casting functionality, Paolo Bonzini, 2024/12/19
- [PULL 32/41] rust: qemu-api: add a module to wrap functions and zero-sized closures, Paolo Bonzini, 2024/12/19
- [PULL 33/41] kvm: consistently return 0/-errno from kvm_convert_memory,
Paolo Bonzini <=
- [PULL 31/41] rust: qom: add initial subset of methods on Object, Paolo Bonzini, 2024/12/19
- [PULL 34/41] target/i386: Reset TSCs of parked vCPUs too on VM reset, Paolo Bonzini, 2024/12/19
- [PULL 35/41] rust: pl011: fix declaration of LineControl bits, Paolo Bonzini, 2024/12/19
- [PULL 36/41] rust: pl011: match break logic of C version, Paolo Bonzini, 2024/12/19
- [PULL 37/41] rust: pl011: always use reset() method on registers, Paolo Bonzini, 2024/12/19
- [PULL 38/41] rust: pl011: fix break errors and definition of Data struct, Paolo Bonzini, 2024/12/19
- [PULL 40/41] rust: pl011: fix migration stream, Paolo Bonzini, 2024/12/19
- [PULL 39/41] rust: pl011: extend registers to 32 bits, Paolo Bonzini, 2024/12/19
- [PULL 41/41] rust: pl011: simplify handling of the FIFO enabled bit in LCR, Paolo Bonzini, 2024/12/19
- Re: [PULL 00/41] Rust, qdev, target/i386 changes for 2024-12-19, Richard Henderson, 2024/12/19