ppc/xics: rework the ICS classes inheritance tree

With the previous changes, we can now let the ICS_KVM class inherit
directly from ICS_BASE class and not from the intermediate ICS_SIMPLE.
It makes the class hierarchy much cleaner.

What is left in the top classes is the low level interface to access
the KVM XICS device in ICS_KVM and the XICS emulating handlers in
ICS_SIMPLE.

This should not break migration compatibility.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Cédric Le Goater 2018-06-25 11:17:18 +02:00 committed by David Gibson
parent c8b1846f23
commit abe82ebb20
2 changed files with 6 additions and 8 deletions

View File

@ -359,12 +359,10 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
ICSStateClass *icsc = ICS_BASE_CLASS(klass); ICSStateClass *icsc = ICS_BASE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass);
/* device_class_set_parent_realize(dc, ics_kvm_realize,
* Use device_class_set_parent_realize() when ics-kvm inherits &icsc->parent_realize);
* directly from ics-base and not from ics-simple anymore. device_class_set_parent_reset(dc, ics_kvm_reset,
*/ &icsc->parent_reset);
dc->realize = ics_kvm_realize;
dc->reset = ics_kvm_reset;
icsc->pre_save = ics_get_kvm_state; icsc->pre_save = ics_get_kvm_state;
icsc->post_load = ics_set_kvm_state; icsc->post_load = ics_set_kvm_state;
@ -373,7 +371,7 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
static const TypeInfo ics_kvm_info = { static const TypeInfo ics_kvm_info = {
.name = TYPE_ICS_KVM, .name = TYPE_ICS_KVM,
.parent = TYPE_ICS_SIMPLE, .parent = TYPE_ICS_BASE,
.instance_size = sizeof(ICSState), .instance_size = sizeof(ICSState),
.class_init = ics_kvm_class_init, .class_init = ics_kvm_class_init,
}; };

View File

@ -137,7 +137,7 @@ static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
goto error; goto error;
} }
return ICS_SIMPLE(obj); return ICS_BASE(obj);
error: error:
error_propagate(errp, local_err); error_propagate(errp, local_err);