From patchwork Wed Mar 1 04:43:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9597475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7929960414 for ; Wed, 1 Mar 2017 04:59:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B9C22811C for ; Wed, 1 Mar 2017 04:59:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F9A42841E; Wed, 1 Mar 2017 04:59:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C6B452811C for ; Wed, 1 Mar 2017 04:59:34 +0000 (UTC) Received: from localhost ([::1]:38415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciwMP-00059B-QJ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 28 Feb 2017 23:59:33 -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 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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édric 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, void *data) static const TypeInfo xics_common_info = { .name = TYPE_XICS_COMMON, - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_DEVICE, .instance_size = sizeof(XICSState), .class_size = sizeof(XICSStateClass), .instance_init = 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, int nr_servers, Error *err = NULL; DeviceState *dev; - dev = qdev_create(NULL, type); + dev = 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 { struct XICSState { /*< private >*/ - SysBusDevice parent_obj; + DeviceState parent_obj; /*< public >*/ uint32_t nr_servers; uint32_t nr_irqs;