From b015a9809427c87940447e5b76a5b73a0bf27d7c Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Mon, 18 Nov 2019 00:20:36 +0100 Subject: xics: Link ICS_PROP_XICS property to ICSState::xics pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ICS object has both a pointer and an ICS_PROP_XICS property pointing to the XICS fabric. Confusing bugs could arise if these ever go out of sync. Change the property definition so that it explicitely sets the pointer. The property isn't optional : not being able to set the link is a bug and QEMU should rather abort than exit in this case. Signed-off-by: Greg Kurz Message-Id: <157403283596.409804.17347207690271971987.stgit@bahia.lan> Reviewed-by: Cédric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'hw/intc/xics.c') diff --git a/hw/intc/xics.c b/hw/intc/xics.c index e7ac9ba618..f7a4548089 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -609,17 +609,8 @@ static void ics_reset_handler(void *dev) static void ics_realize(DeviceState *dev, Error **errp) { ICSState *ics = ICS(dev); - Error *local_err = NULL; - Object *obj; - obj = object_property_get_link(OBJECT(dev), ICS_PROP_XICS, &local_err); - if (!obj) { - error_propagate_prepend(errp, local_err, - "required link '" ICS_PROP_XICS - "' not found: "); - return; - } - ics->xics = XICS_FABRIC(obj); + assert(ics->xics); if (!ics->nr_irqs) { error_setg(errp, "Number of interrupts needs to be greater 0"); @@ -699,6 +690,8 @@ static const VMStateDescription vmstate_ics = { static Property ics_properties[] = { DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0), + DEFINE_PROP_LINK(ICS_PROP_XICS, ICSState, xics, TYPE_XICS_FABRIC, + XICSFabric *), DEFINE_PROP_END_OF_LIST(), }; -- cgit v1.2.3