[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 4/5] ppc/kvm: Use error_report() instead of cpu_abort()
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 4/5] ppc/kvm: Use error_report() instead of cpu_abort() for user-triggerable errors |
Date: |
Thu, 25 Feb 2016 14:02:09 +1100 |
From: Thomas Huth <address@hidden>
Setting the KVM_CAP_PPC_PAPR capability can fail if either the KVM
kernel module does not support it, or if the specified vCPU type
is not a 64-bit Book3-S CPU type. For example, the user can trigger
it easily with "-M pseries -cpu G2leLS" when using the kvm-pr kernel
module. So the error should not be reported with cpu_abort() since
this function is rather meant for reporting programming errors than
reporting user-triggerable errors (it prints out all CPU registers
and then calls abort() to kills the program - two things that the
normal user does not expect here) . So let's use error_report() with
exit(1) here instead.
A similar problem exists in the code that sets the KVM_CAP_PPC_EPR
capability, so while we're at it, fix that, too.
Signed-off-by: Thomas Huth <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target-ppc/kvm.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 70ca296..762d6cf 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -23,6 +23,7 @@
#include <linux/kvm.h>
#include "qemu-common.h"
+#include "qemu/error-report.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
@@ -1993,7 +1994,8 @@ void kvmppc_set_papr(PowerPCCPU *cpu)
ret = kvm_vcpu_enable_cap(cs, KVM_CAP_PPC_PAPR, 0);
if (ret) {
- cpu_abort(cs, "This KVM version does not support PAPR\n");
+ error_report("This vCPU type or KVM version does not support PAPR");
+ exit(1);
}
/* Update the capability flag so we sync the right information
@@ -2013,7 +2015,8 @@ void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int
mpic_proxy)
ret = kvm_vcpu_enable_cap(cs, KVM_CAP_PPC_EPR, 0, mpic_proxy);
if (ret && mpic_proxy) {
- cpu_abort(cs, "This KVM version does not support EPR\n");
+ error_report("This KVM version does not support EPR");
+ exit(1);
}
}
--
2.5.0
- [Qemu-ppc] [PULL 0/5] ppc-for-2.6 queue 20160225, David Gibson, 2016/02/24
- [Qemu-ppc] [PULL 5/5] ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv, David Gibson, 2016/02/24
- [Qemu-ppc] [PULL 4/5] ppc/kvm: Use error_report() instead of cpu_abort() for user-triggerable errors,
David Gibson <=
- [Qemu-ppc] [PULL 2/5] hw/ppc/spapr: Implement the h_page_init hypercall, David Gibson, 2016/02/24
- [Qemu-ppc] [PULL 3/5] spapr: initialize local Error pointer, David Gibson, 2016/02/24
- [Qemu-ppc] [PULL 1/5] pseries: Update SLOF firmware image to 20160223, David Gibson, 2016/02/25
- Re: [Qemu-ppc] [PULL 0/5] ppc-for-2.6 queue 20160225, Peter Maydell, 2016/02/25