[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 15/38] PPC: Clean up misuse of qdev_init() in kvm-openp
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 15/38] PPC: Clean up misuse of qdev_init() in kvm-openpic creation |
Date: |
Sun, 8 Mar 2015 09:44:34 +0100 |
From: Markus Armbruster <address@hidden>
We call ppce500_init_mpic_kvm() to create a "kvm-openpic". If it
fails, we call ppce500_init_mpic_qemu() to fall back to plain
"openpic".
ppce500_init_mpic_kvm() uses qdev_init(). qdev_init()'s error
handling has an unwanted side effect: it calls qerror_report_err(),
which prints to stderr. Looks like an error, but isn't.
In QMP context, it would stash the error in the monitor instead,
making the QMP command fail. Fortunately, it's only called from board
initialization, never in QMP context.
Clean up by cutting out the qdev_init() middle-man: set property
"realized" directly.
While there, improve the error message when we can't satisfy an
explicit user request for "kvm-openpic", and exit(1) instead of
abort().
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/e500.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 7e17d18..fd0d138 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -706,17 +706,19 @@ static DeviceState *ppce500_init_mpic_qemu(PPCE500Params
*params,
}
static DeviceState *ppce500_init_mpic_kvm(PPCE500Params *params,
- qemu_irq **irqs)
+ qemu_irq **irqs, Error **errp)
{
+ Error *err = NULL;
DeviceState *dev;
CPUState *cs;
- int r;
dev = qdev_create(NULL, TYPE_KVM_OPENPIC);
qdev_prop_set_uint32(dev, "model", params->mpic_version);
- r = qdev_init(dev);
- if (r) {
+ object_property_set_bool(OBJECT(dev), true, "realized", &err);
+ if (err) {
+ error_propagate(errp, err);
+ object_unparent(OBJECT(dev));
return NULL;
}
@@ -747,15 +749,15 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params,
MemoryRegion *ccsr,
"kernel_irqchip", true);
bool irqchip_required = qemu_opt_get_bool(machine_opts,
"kernel_irqchip", false);
+ Error *err = NULL;
if (irqchip_allowed) {
- dev = ppce500_init_mpic_kvm(params, irqs);
+ dev = ppce500_init_mpic_kvm(params, irqs, &err);
}
-
if (irqchip_required && !dev) {
- fprintf(stderr, "%s: irqchip requested but unavailable\n",
- __func__);
- abort();
+ error_report("kernel_irqchip requested but unavailable: %s",
+ error_get_pretty(err));
+ exit(1);
}
}
--
1.8.1.4
- [Qemu-ppc] [PULL 2.3 00/38] ppc patch queue 2015-03-08, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 02/38] target-ppc: Use right page size with hash table lookup, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 09/38] pseries: Add more parameter validation in RTAS time of day functions, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 33/38] ppc64-softmmu: Remove duplicated OPENPIC from config, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 20/38] display cpu id dump state, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 14/38] pseries: Export RTC time via QOM, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 24/38] target-ppc: move sdr1 value change detection logic to helper_store_sdr1(), Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 15/38] PPC: Clean up misuse of qdev_init() in kvm-openpic creation,
Alexander Graf <=
- [Qemu-ppc] [PULL 06/38] Generalize QOM publishing of date and time from mc146818rtc.c, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 25/38] target-ppc: force update of msr bits in cpu_post_load, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 05/38] spapr-pci: Enable huge BARs, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 16/38] spapr: Clean up misuse of qdev_init() in xics-kvm creation, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 26/38] openpic: fix segfault on -M mac99 savevm, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 23/38] cuda.c: include adb_poll_timer in VMStateDescription, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 01/38] spapr_vio/spapr_iommu: Move VIO bypass where it belongs, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 38/38] sPAPR: Implement sPAPRPHBClass EEH callbacks, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 28/38] openpic: switch IRQQueue queue from inline to bitmap, Alexander Graf, 2015/03/08
- [Qemu-ppc] [PULL 31/38] Revert "default-configs/ppc64: add all components of i82378 SuperIO chip used by prep", Alexander Graf, 2015/03/08