[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 12/15] spapr/irq: remove spapr_ics_create()
From: |
Cédric Le Goater |
Subject: |
[Qemu-devel] [PATCH v3 12/15] spapr/irq: remove spapr_ics_create() |
Date: |
Thu, 21 Mar 2019 15:49:11 +0100 |
spapr_ics_create() is only called once. Merge it in spapr_irq_init_xics()
and simplify a bit the error handling by using 'error_fatal' .
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/ppc/spapr_irq.c | 44 ++++++++++++++------------------------------
1 file changed, 14 insertions(+), 30 deletions(-)
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index b4e3128b7f06..d7130f66dbaa 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -66,36 +66,11 @@ void spapr_irq_msi_reset(SpaprMachineState *spapr)
* XICS IRQ backend.
*/
-static ICSState *spapr_ics_create(SpaprMachineState *spapr,
- int nr_irqs, Error **errp)
-{
- Error *local_err = NULL;
- Object *obj;
-
- obj = object_new(TYPE_ICS_SIMPLE);
- object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
- object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
- &error_abort);
- object_property_set_int(obj, nr_irqs, "nr-irqs", &local_err);
- if (local_err) {
- goto error;
- }
- object_property_set_bool(obj, true, "realized", &local_err);
- if (local_err) {
- goto error;
- }
-
- return ICS_BASE(obj);
-
-error:
- error_propagate(errp, local_err);
- return NULL;
-}
-
static void spapr_irq_init_xics(SpaprMachineState *spapr, int nr_irqs,
Error **errp)
{
MachineState *machine = MACHINE(spapr);
+ Object *obj;
Error *local_err = NULL;
bool xics_kvm = false;
@@ -107,7 +82,8 @@ static void spapr_irq_init_xics(SpaprMachineState *spapr,
int nr_irqs,
if (machine_kernel_irqchip_required(machine) && !xics_kvm) {
error_prepend(&local_err,
"kernel_irqchip requested but unavailable: ");
- goto error;
+ error_propagate(errp, local_err);
+ return;
}
error_free(local_err);
local_err = NULL;
@@ -117,10 +93,18 @@ static void spapr_irq_init_xics(SpaprMachineState *spapr,
int nr_irqs,
xics_spapr_init(spapr);
}
- spapr->ics = spapr_ics_create(spapr, nr_irqs, &local_err);
+ obj = object_new(TYPE_ICS_SIMPLE);
+ object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
+ object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
+ &error_fatal);
+ object_property_set_int(obj, nr_irqs, "nr-irqs", &error_fatal);
+ object_property_set_bool(obj, true, "realized", &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
-error:
- error_propagate(errp, local_err);
+ spapr->ics = ICS_BASE(obj);
}
#define ICS_IRQ_FREE(ics, srcno) \
--
2.20.1
- [Qemu-devel] [PATCH v3 05/15] spapr/xive: introduce a VM state change handler, (continued)
- [Qemu-devel] [PATCH v3 05/15] spapr/xive: introduce a VM state change handler, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 03/15] spapr/xive: add hcall support when under KVM, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 08/15] spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 07/15] spapr/xive: activate KVM support, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 09/15] sysbus: add a sysbus_mmio_unmap() helper, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 10/15] spapr: introduce routines to delete the KVM IRQ device, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 11/15] spapr: check for the activation of the KVM IRQ device, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 12/15] spapr/irq: remove spapr_ics_create(),
Cédric Le Goater <=
- [Qemu-devel] [PATCH v3 13/15] spapr/irq: introduce a spapr_irq_init_device() helper, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 14/15] spapr/irq: initialize the IRQ device only once, Cédric Le Goater, 2019/03/21
- [Qemu-devel] [PATCH v3 15/15] spapr/irq: add KVM support to the 'dual' machine, Cédric Le Goater, 2019/03/21