diff options
author | Greg Kurz <groug@kaod.org> | 2017-09-15 15:16:10 +0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-09-27 13:05:41 +1000 |
commit | 82be8e7394b31fd2d740651365b8ebdd0c847529 (patch) | |
tree | c762b6a2511d090f6c485d0b9d5e876308de35b0 /target/ppc/kvm.c | |
parent | 58b62835863db2164002ad843455045c29bcb029 (diff) | |
download | qemu-82be8e7394b31fd2d740651365b8ebdd0c847529.zip |
ppc/kvm: change kvmppc_get_htab_fd() to return -errno on error
When kvmppc_get_htab_fd() fails, its return value is propagated up to
qemu_savevm_state_iterate() or to qemu_savevm_state_complete_precopy().
All savevm handlers expect to receive a negative errno on error.
Let's patch kvmppc_get_htab_fd() accordingly.
While here, let's change htab_load() in the spapr code to also
propagate the error, since it doesn't make sense to abort() if
we couldn't get the htab fd from KVM.
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target/ppc/kvm.c')
-rw-r--r-- | target/ppc/kvm.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index be27429b57..2780e692a7 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2556,13 +2556,19 @@ int kvmppc_get_htab_fd(bool write) .flags = write ? KVM_GET_HTAB_WRITE : 0, .start_index = 0, }; + int ret; if (!cap_htab_fd) { fprintf(stderr, "KVM version doesn't support saving the hash table\n"); - return -1; + return -ENOTSUP; + } + + ret = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s); + if (ret < 0) { + return -errno; } - return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s); + return ret; } int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns) |