提交 444d6ca3 编写于 作者: G Greg Kurz 提交者: David Gibson

spapr/irq: Use the "simple" ICS class for KVM

The "simple" ICS class knows how to interract with KVM. Adapt sPAPR to use
it instead of the ICS KVM class.
Signed-off-by: NGreg Kurz <groug@kaod.org>
Message-Id: <155023083585.1011724.2868047424353921455.stgit@bahia.lan>
Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
上级 557b4567
...@@ -67,13 +67,12 @@ void spapr_irq_msi_reset(sPAPRMachineState *spapr) ...@@ -67,13 +67,12 @@ void spapr_irq_msi_reset(sPAPRMachineState *spapr)
*/ */
static ICSState *spapr_ics_create(sPAPRMachineState *spapr, static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
const char *type_ics,
int nr_irqs, Error **errp) int nr_irqs, Error **errp)
{ {
Error *local_err = NULL; Error *local_err = NULL;
Object *obj; Object *obj;
obj = object_new(type_ics); obj = object_new(TYPE_ICS_SIMPLE);
object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort); object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr), object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
&error_abort); &error_abort);
...@@ -98,14 +97,14 @@ static void spapr_irq_init_xics(sPAPRMachineState *spapr, int nr_irqs, ...@@ -98,14 +97,14 @@ static void spapr_irq_init_xics(sPAPRMachineState *spapr, int nr_irqs,
{ {
MachineState *machine = MACHINE(spapr); MachineState *machine = MACHINE(spapr);
Error *local_err = NULL; Error *local_err = NULL;
bool xics_kvm = false;
if (kvm_enabled()) { if (kvm_enabled()) {
if (machine_kernel_irqchip_allowed(machine) && if (machine_kernel_irqchip_allowed(machine) &&
!xics_kvm_init(spapr, &local_err)) { !xics_kvm_init(spapr, &local_err)) {
spapr->ics = spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs, xics_kvm = true;
&local_err);
} }
if (machine_kernel_irqchip_required(machine) && !spapr->ics) { if (machine_kernel_irqchip_required(machine) && !xics_kvm) {
error_prepend(&local_err, error_prepend(&local_err,
"kernel_irqchip requested but unavailable: "); "kernel_irqchip requested but unavailable: ");
goto error; goto error;
...@@ -114,12 +113,12 @@ static void spapr_irq_init_xics(sPAPRMachineState *spapr, int nr_irqs, ...@@ -114,12 +113,12 @@ static void spapr_irq_init_xics(sPAPRMachineState *spapr, int nr_irqs,
local_err = NULL; local_err = NULL;
} }
if (!spapr->ics) { if (!xics_kvm) {
xics_spapr_init(spapr); xics_spapr_init(spapr);
spapr->ics = spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs,
&local_err);
} }
spapr->ics = spapr_ics_create(spapr, nr_irqs, &local_err);
error: error:
error_propagate(errp, local_err); error_propagate(errp, local_err);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册