spapr: fix error reporting in xics_system_init()
If the user explicitely asked for kernel-irqchip support and "xics-kvm" initialization fails, we shouldn't fallback to emulated "xics" as we do now. It is also awkward to print an error message when we have an errp pointer argument. Let's use the errp argument to report the error and let the caller decide. This simplifies the code as we don't need a local Error * here. Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
249127d0df
commit
3d85885a1b
@ -128,18 +128,14 @@ static void xics_system_init(MachineState *machine, int nr_irqs, Error **errp)
|
|||||||
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
|
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
|
||||||
|
|
||||||
if (kvm_enabled()) {
|
if (kvm_enabled()) {
|
||||||
Error *err = NULL;
|
|
||||||
|
|
||||||
if (machine_kernel_irqchip_allowed(machine) &&
|
if (machine_kernel_irqchip_allowed(machine) &&
|
||||||
!xics_kvm_init(spapr, errp)) {
|
!xics_kvm_init(spapr, errp)) {
|
||||||
spapr->icp_type = TYPE_KVM_ICP;
|
spapr->icp_type = TYPE_KVM_ICP;
|
||||||
spapr->ics = spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs, &err);
|
spapr->ics = spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs, errp);
|
||||||
}
|
}
|
||||||
if (machine_kernel_irqchip_required(machine) && !spapr->ics) {
|
if (machine_kernel_irqchip_required(machine) && !spapr->ics) {
|
||||||
error_reportf_err(err,
|
error_prepend(errp, "kernel_irqchip requested but unavailable: ");
|
||||||
"kernel_irqchip requested but unavailable: ");
|
return;
|
||||||
} else {
|
|
||||||
error_free(err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +143,9 @@ static void xics_system_init(MachineState *machine, int nr_irqs, Error **errp)
|
|||||||
xics_spapr_init(spapr);
|
xics_spapr_init(spapr);
|
||||||
spapr->icp_type = TYPE_ICP;
|
spapr->icp_type = TYPE_ICP;
|
||||||
spapr->ics = spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs, errp);
|
spapr->ics = spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs, errp);
|
||||||
|
if (!spapr->ics) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user