summaryrefslogtreecommitdiff
path: root/hw/intc/xics.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2017-12-01 17:06:00 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2017-12-15 09:49:24 +1100
commit4f7a47beebd6d37861d08c81941be1b33a0ae627 (patch)
treef76c0b3764e6f92a3020ea4bb84bef31922eb51e /hw/intc/xics.c
parent3fe4f0fc8530e9411819f02accf2d17c128061b0 (diff)
downloadqemu-4f7a47beebd6d37861d08c81941be1b33a0ae627.tar.gz
ppc/xics: introduce an icp_create() helper
The sPAPR and the PowerNV core objects create the interrupt presenter object of the CPUs in a very similar way. Let's provide a common routine in which we use the presenter 'type' as a child identifier. Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/intc/xics.c')
-rw-r--r--hw/intc/xics.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index a1cc0e420c..bfc6b5bb23 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -384,6 +384,27 @@ static const TypeInfo icp_info = {
.class_size = sizeof(ICPStateClass),
};
+Object *icp_create(Object *cpu, const char *type, XICSFabric *xi, Error **errp)
+{
+ Error *local_err = NULL;
+ Object *obj;
+
+ obj = object_new(type);
+ object_property_add_child(cpu, type, obj, &error_abort);
+ object_unref(obj);
+ object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(xi),
+ &error_abort);
+ object_property_add_const_link(obj, ICP_PROP_CPU, cpu, &error_abort);
+ object_property_set_bool(obj, true, "realized", &local_err);
+ if (local_err) {
+ object_unparent(obj);
+ error_propagate(errp, local_err);
+ obj = NULL;
+ }
+
+ return obj;
+}
+
/*
* ICS: Source layer
*/