On Thu, 8 Jun 2017 16:04:21 +0200 Cédric Le Goater <c...@kaod.org> wrote:
> On 06/08/2017 03:42 PM, Greg Kurz wrote: > > These properties are part of the XICS API. They deserve to appear > > explicitely in the XICS header file. > > I don't see the benefits. > The links need to be set with the appropriate name otherwise XICS bails out. When David asked to rename the "cs" prop to "cpu", I forgot to patch pnv accordingly in the first place. :) FWIW, other people do that as well (see hw/i386/pc_q35.c for example). > C. > > > > > > Signed-off-by: Greg Kurz <gr...@kaod.org> > > --- > > hw/intc/xics.c | 8 ++++---- > > hw/ppc/pnv_core.c | 3 ++- > > hw/ppc/pnv_psi.c | 3 ++- > > hw/ppc/spapr.c | 3 ++- > > hw/ppc/spapr_cpu_core.c | 3 ++- > > include/hw/ppc/xics.h | 4 ++++ > > 6 files changed, 16 insertions(+), 8 deletions(-) > > > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > > index ec73f02144c9..aa2c4e744f65 100644 > > --- a/hw/intc/xics.c > > +++ b/hw/intc/xics.c > > @@ -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; > > } > > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c > > index e8a9a94d5a24..0b6e72950ca3 100644 > > --- a/hw/ppc/pnv_core.c > > +++ b/hw/ppc/pnv_core.c > > @@ -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); > > diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c > > index 2bf5bfe3fdd6..9876c266223d 100644 > > --- a/hw/ppc/pnv_psi.c > > +++ b/hw/ppc/pnv_psi.c > > @@ -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); > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 01dda9ea9fb7..b2951d7618d6 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -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; > > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > > index 029a14120edd..e81879c7cad7 100644 > > --- a/hw/ppc/spapr_cpu_core.c > > +++ b/hw/ppc/spapr_cpu_core.c > > @@ -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; > > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > > index 40a506eacfb4..31145326ebf9 100644 > > --- a/include/hw/ppc/xics.h > > +++ b/include/hw/ppc/xics.h > > @@ -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) > > >
pgp6TScfbTK2t.pgp
Description: OpenPGP digital signature