[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/40] hw/ppc/spapr_cpu_core: Add a proper check for
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 28/40] hw/ppc/spapr_cpu_core: Add a proper check for spapr machine |
Date: |
Fri, 8 Sep 2017 20:35:46 +1000 |
From: Thomas Huth <address@hidden>
QEMU currently crashes when the user tries to add a spapr-cpu-core
on a non-pseries machine:
$ qemu-system-ppc64 -S -machine ppce500,accel=tcg \
-device POWER5+_v2.1-spapr-cpu-core
hw/ppc/spapr_cpu_core.c:178:spapr_cpu_core_realize_child:
Object 0x55cee1f55160 is not an instance of type spapr-machine
Aborted (core dumped)
So let's add a proper check for the correct machine time with
a more friendly error message here.
Reported-by: Eduardo Habkost <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_cpu_core.c | 5 +++++
scripts/device-crash-test | 3 +++
2 files changed, 8 insertions(+)
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index ea278ce2a7..dd9232620d 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -220,6 +220,11 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error
**errp)
void *obj;
int i, j;
+ if (!object_dynamic_cast(qdev_get_machine(), TYPE_SPAPR_MACHINE)) {
+ error_setg(errp, "spapr-cpu-core needs a pseries machine");
+ return;
+ }
+
sc->threads = g_malloc0(size * cc->nr_threads);
for (i = 0; i < cc->nr_threads; i++) {
char id[32];
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index 81d65b9617..043b24a4aa 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -160,6 +160,9 @@ ERROR_WHITELIST = [
{'machine':'q35|pc.*', 'device':'kvm-ioapic', 'expected':True}, # Only 1
ioapics allowed
{'machine':'q35|pc.*', 'device':'ioapic', 'expected':True}, # Only 1
ioapics allowed
+ # "spapr-cpu-core needs a pseries machine"
+ {'machine':'(?!pseries).*', 'device':'.*-spapr-cpu-core', 'expected':True},
+
# KVM-specific devices shouldn't be tried without accel=kvm:
{'accel':'(?!kvm).*', 'device':'kvmclock', 'expected':True},
{'accel':'(?!kvm).*', 'device':'kvm-pci-assign', 'expected':True},
--
2.13.5
- [Qemu-devel] [PULL 09/40] spapr_drc: add unrealize method to physical DRC class, (continued)
- [Qemu-devel] [PULL 09/40] spapr_drc: add unrealize method to physical DRC class, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 10/40] spapr_drc: pass object ownership to parent/owner, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 14/40] e500: Use cpu_index instead of vcpu_dt_id, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 21/40] spapr_iommu: Realloc guest visible TCE table when hot(un)plugging vfio-pci, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 16/40] ppc: spapr: Make VCPU ID handling private to SPAPR, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 06/40] spapr_drc: use g_strdup_printf() instead of snprintf(), David Gibson, 2017/09/08
- [Qemu-devel] [PULL 18/40] booke206: fix tlbnps for fixed size TLB, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 19/40] booke206: allow to specify an mmucfg value at the init, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 20/40] ppc64: introduce e6500, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 15/40] ppc: spapr: Rename cpu_dt_id to vcpu_id, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 28/40] hw/ppc/spapr_cpu_core: Add a proper check for spapr machine,
David Gibson <=
- [Qemu-devel] [PULL 23/40] ppc4xx: Make MAL emulation more generic, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 13/40] spapr: add pseries-2.11 machine type, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 27/40] ppc4xx: Export ECB and PLB emulation, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 29/40] hw/nvram/spapr_nvram: Device can not be created by the users, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 36/40] ppc: replace inter-function cyclic dependency/recurssion with 2 simple lookups, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 24/40] ppc4xx: Split off 4xx I2C emulation from ppc405_uc to its own file, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 26/40] ppc4xx_i2c: Move to hw/i2c, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 37/40] ppc: simplify cpu model lookup by PVR, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 25/40] ppc4xx_i2c: QOMify, David Gibson, 2017/09/08
- [Qemu-devel] [PULL 33/40] ppc: use macros to make cpu type name from string literal, David Gibson, 2017/09/08