From nobody Thu Nov 6 19:13:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488344415343112.66936594973322; Tue, 28 Feb 2017 21:00:15 -0800 (PST) Received: from localhost ([::1]:38415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciwN3-00059B-WE for importer@patchew.org; Wed, 01 Mar 2017 00:00:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciw7q-00085M-1e for qemu-devel@nongnu.org; Tue, 28 Feb 2017 23:44:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciw7n-00008a-SK for qemu-devel@nongnu.org; Tue, 28 Feb 2017 23:44:30 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:39689) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciw7n-00005o-Cg; Tue, 28 Feb 2017 23:44:27 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vY2sT2DDdz9sP9; Wed, 1 Mar 2017 15:44:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1488343453; bh=w90a4vQX31S91mzmfCsRIBYFBK2YGh5qN0OXjvIAYmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AiC3JVwHNC/jWw8S5tB5Pbmspjh4F9YHcZ7XB+59063gbfWBTj8UmgvTdQqvJmJaJ ULbckTFXgyAWtQ9FnpuLEPVW4gQZ+MGciIQZALWkCN8oHGQGcFoYRH9Tschfhbl6hV Uo45ZcIn9D3A6Bl5N+lSB7ZM/RG3BLE/HX31ZWG4= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 1 Mar 2017 15:43:40 +1100 Message-Id: <20170301044405.1792-26-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170301044405.1792-1-david@gibson.dropbear.id.au> References: <20170301044405.1792-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 25/50] xics: XICS should not be a SysBusDevice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Currently xics - the component of the IBM POWER interrupt controller representing the overall interrupt fabric / architecture is represented as a descendent of SysBusDevice. However, this is not really correct - the xics presents nothing in MMIO space so it should be an "unattached" device in the current QOM model. Since this device will always be created by the machine type, not created specifically from the command line, and because it has no migrated state it should be safe to move it around the device composition tree. Therefore this patch changes it to a descendent of TYPE_DEVICE, and makes it an unattached device. So that its reset handler still gets called correctly, we add a qdev_set_parent_bus() to attach it to sysbus. It's not really clear that's correct (instead of using register_reset()) but it appears to a common technique. Signed-off-by: David Gibson [clg corrected problems with reset] Signed-off-by: C=C3=A9dric Le Goater [dwg folded together and updated commit message] Signed-off-by: David Gibson --- hw/intc/xics.c | 2 +- hw/ppc/spapr.c | 3 ++- include/hw/ppc/xics.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 095c16a..372b831 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -260,7 +260,7 @@ static void xics_common_class_init(ObjectClass *oc, voi= d *data) =20 static const TypeInfo xics_common_info =3D { .name =3D TYPE_XICS_COMMON, - .parent =3D TYPE_SYS_BUS_DEVICE, + .parent =3D TYPE_DEVICE, .instance_size =3D sizeof(XICSState), .class_size =3D sizeof(XICSStateClass), .instance_init =3D xics_common_initfn, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index e0bb9bc..0c475f4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -101,9 +101,10 @@ static XICSState *try_create_xics(const char *type, in= t nr_servers, Error *err =3D NULL; DeviceState *dev; =20 - dev =3D qdev_create(NULL, type); + dev =3D DEVICE(object_new(type)); qdev_prop_set_uint32(dev, "nr_servers", nr_servers); qdev_prop_set_uint32(dev, "nr_irqs", nr_irqs); + qdev_set_parent_bus(dev, sysbus_get_default()); object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err) { error_propagate(errp, err); diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 3f0c316..1aefd3d 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -80,7 +80,7 @@ struct XICSStateClass { =20 struct XICSState { /*< private >*/ - SysBusDevice parent_obj; + DeviceState parent_obj; /*< public >*/ uint32_t nr_servers; uint32_t nr_irqs; --=20 2.9.3