[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 12/26] ppc/kvm: change kvmppc_get_htab_fd() to return -
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 12/26] ppc/kvm: change kvmppc_get_htab_fd() to return -errno on error |
Date: |
Wed, 27 Sep 2017 17:43:02 +1000 |
From: Greg Kurz <address@hidden>
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 <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr.c | 5 +++--
target/ppc/kvm.c | 10 ++++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 17ea77618c..ec0ea7b5dd 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1218,7 +1218,7 @@ static int get_htab_fd(sPAPRMachineState *spapr)
spapr->htab_fd = kvmppc_get_htab_fd(false);
if (spapr->htab_fd < 0) {
error_report("Unable to open fd for reading hash table from KVM: %s",
- strerror(errno));
+ strerror(spapr->htab_fd));
}
return spapr->htab_fd;
@@ -1958,7 +1958,8 @@ static int htab_load(QEMUFile *f, void *opaque, int
version_id)
fd = kvmppc_get_htab_fd(true);
if (fd < 0) {
error_report("Unable to open fd to restore KVM hash table: %s",
- strerror(errno));
+ strerror(fd));
+ return fd;
}
}
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)
--
2.13.5
- [Qemu-ppc] [PULL 05/26] ppc: Add 460EX embedded CPU, (continued)
- [Qemu-ppc] [PULL 05/26] ppc: Add 460EX embedded CPU, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 11/26] ppc: Fix OpenPIC model, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 01/26] ppc/kvm: check some capabilities with kvm_vm_check_extension(), David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 09/26] ppc/mac: More rework of the DBDMA emulation, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 07/26] ppc: QOMify g3beige machine, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 17/26] spapr_pci: make index property mandatory, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 25/26] macio: pass channel into MACIOIDEState via qdev property, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 13/26] ppc/kvm: generalize the use of kvmppc_get_htab_fd(), David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 24/26] mac_dbdma: remove DBDMA_init() function, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 23/26] mac_dbdma: QOMify, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 12/26] ppc/kvm: change kvmppc_get_htab_fd() to return -errno on error,
David Gibson <=
- [Qemu-ppc] [PULL 19/26] ppc: remove all unused CPU definitions, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 21/26] spapr: fix the value of SDR1 in kvmppc_put_books_sregs(), David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 16/26] macio: convert pmac_ide_ops from old_mmio, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 26/26] macio: use object link between MACIO_IDE and MAC_DBDMA object, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 14/26] spapr: introduce helpers to migrate HPT chunks and the end marker, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 20/26] ppc/pnv: check for OPAL firmware file presence, David Gibson, 2017/09/27
- [Qemu-ppc] [PULL 22/26] mac_dbdma: remove unused IO fields from DBDMAState, David Gibson, 2017/09/27
- Re: [Qemu-ppc] [PULL 00/26] ppc-for-2.11 queue 20170927, Peter Maydell, 2017/09/27