xics: introduce macros for ICP/ICS link properties

These properties are part of the XICS API. They deserve to appear
explicitely in the XICS header file.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Greg Kurz 2017-06-08 15:42:41 +02:00 committed by David Gibson
parent 3b95410507
commit ad265631c0
6 changed files with 16 additions and 8 deletions

View File

@ -346,9 +346,9 @@ static void icp_realize(DeviceState *dev, Error **errp)
Object *obj;
Error *err = NULL;
obj = object_property_get_link(OBJECT(dev), "xics", &err);
obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err);
if (!obj) {
error_setg(errp, "%s: required link 'xics' not found: %s",
error_setg(errp, "%s: required link '" ICP_PROP_XICS "' not found: %s",
__func__, error_get_pretty(err));
return;
}
@ -654,9 +654,9 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
Object *obj;
Error *err = NULL;
obj = object_property_get_link(OBJECT(dev), "xics", &err);
obj = object_property_get_link(OBJECT(dev), ICS_PROP_XICS, &err);
if (!obj) {
error_setg(errp, "%s: required link 'xics' not found: %s",
error_setg(errp, "%s: required link '" ICS_PROP_XICS "' not found: %s",
__func__, error_get_pretty(err));
return;
}

View File

@ -121,7 +121,8 @@ static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)
obj = object_new(TYPE_PNV_ICP);
object_property_add_child(OBJECT(cpu), "icp", obj, &error_abort);
object_unref(obj);
object_property_add_const_link(obj, "xics", OBJECT(xi), &error_abort);
object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(xi),
&error_abort);
object_property_set_bool(obj, true, "realized", &local_err);
if (local_err) {
error_propagate(errp, local_err);

View File

@ -474,7 +474,8 @@ static void pnv_psi_realize(DeviceState *dev, Error **errp)
}
/* Create PSI interrupt control source */
object_property_add_const_link(OBJECT(ics), "xics", obj, &error_abort);
object_property_add_const_link(OBJECT(ics), ICS_PROP_XICS, obj,
&error_abort);
object_property_set_int(OBJECT(ics), PSI_NUM_INTERRUPTS, "nr-irqs", &err);
if (err) {
error_propagate(errp, err);

View File

@ -107,7 +107,8 @@ static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
obj = object_new(type_ics);
object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
object_property_add_const_link(obj, "xics", OBJECT(spapr), &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;

View File

@ -145,7 +145,8 @@ static void spapr_cpu_core_realize_child(Object *child, Error **errp)
obj = object_new(spapr->icp_type);
object_property_add_child(OBJECT(cpu), "icp", obj, &error_abort);
object_unref(obj);
object_property_add_const_link(obj, "xics", OBJECT(spapr), &error_abort);
object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(spapr),
&error_abort);
object_property_set_bool(obj, true, "realized", &local_err);
if (local_err) {
goto error;

View File

@ -86,6 +86,8 @@ struct ICPState {
XICSFabric *xics;
};
#define ICP_PROP_XICS "xics"
struct PnvICPState {
ICPState parent_obj;
@ -130,6 +132,8 @@ struct ICSState {
XICSFabric *xics;
};
#define ICS_PROP_XICS "xics"
static inline bool ics_valid_irq(ICSState *ics, uint32_t nr)
{
return (ics->offset != 0) && (nr >= ics->offset)