From nobody Sun Apr 28 17:05:47 2024 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 1492753332282777.3159373668726; Thu, 20 Apr 2017 22:42:12 -0700 (PDT) Received: from localhost ([::1]:57258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RKc-0006V6-Sn for importer@patchew.org; Fri, 21 Apr 2017 01:42:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RIr-0005F1-0s for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1RIm-0004Rk-Mu for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34566) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1RIm-0004R6-EX for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6671865D14 for ; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-149.ams2.redhat.com [10.36.116.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 05DCE17AF8; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6C2B01138649; Fri, 21 Apr 2017 07:40:13 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6671865D14 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6671865D14 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 21 Apr 2017 07:40:10 +0200 Message-Id: <1492753213-26516-2-git-send-email-armbru@redhat.com> In-Reply-To: <1492753213-26516-1-git-send-email-armbru@redhat.com> References: <1492753213-26516-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Apr 2017 05:40:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] arm: remove remaining cannot_destroy_with_object_finalize_yet 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: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier With commit ce5b1bbf624b ("exec: move cpu_exec_init() calls to realize functions"), we can now remove all the remaining cannot_destroy_with_object_finalize_yet as unsafe references have been moved to cpu_exec_realizefn(). (tested with QOM command provided by commit 4c315c27). Suggested-by: Markus Armbruster Signed-off-by: Laurent Vivier Reviewed-by: Markus Armbruster Message-Id: <20170414083717.13641-2-lvivier@redhat.com> Acked-by: Alistair Francis Acked-by: Peter Maydell Signed-off-by: Markus Armbruster --- hw/arm/allwinner-a10.c | 6 ------ hw/arm/bcm2836.c | 6 ------ hw/arm/digic.c | 6 ------ hw/arm/fsl-imx25.c | 5 ----- hw/arm/fsl-imx31.c | 5 ----- hw/arm/fsl-imx6.c | 5 ----- hw/arm/xlnx-zynqmp.c | 6 ------ 7 files changed, 39 deletions(-) diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index ca15d1c..f62a9a3 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -118,12 +118,6 @@ static void aw_a10_class_init(ObjectClass *oc, void *d= ata) DeviceClass *dc =3D DEVICE_CLASS(oc); =20 dc->realize =3D aw_a10_realize; - - /* - * Reason: creates an ARM CPU, thus use after free(), see - * arm_cpu_class_init() - */ - dc->cannot_destroy_with_object_finalize_yet =3D true; } =20 static const TypeInfo aw_a10_type_info =3D { diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 8451190..8c43291 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -160,12 +160,6 @@ static void bcm2836_class_init(ObjectClass *oc, void *= data) =20 dc->props =3D bcm2836_props; dc->realize =3D bcm2836_realize; - - /* - * Reason: creates an ARM CPU, thus use after free(), see - * arm_cpu_class_init() - */ - dc->cannot_destroy_with_object_finalize_yet =3D true; } =20 static const TypeInfo bcm2836_type_info =3D { diff --git a/hw/arm/digic.c b/hw/arm/digic.c index d60ea39..94f3263 100644 --- a/hw/arm/digic.c +++ b/hw/arm/digic.c @@ -101,12 +101,6 @@ static void digic_class_init(ObjectClass *oc, void *da= ta) DeviceClass *dc =3D DEVICE_CLASS(oc); =20 dc->realize =3D digic_realize; - - /* - * Reason: creates an ARM CPU, thus use after free(), see - * arm_cpu_class_init() - */ - dc->cannot_destroy_with_object_finalize_yet =3D true; } =20 static const TypeInfo digic_type_info =3D { diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 2126f73..9056f27 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -290,11 +290,6 @@ static void fsl_imx25_class_init(ObjectClass *oc, void= *data) =20 dc->realize =3D fsl_imx25_realize; =20 - /* - * Reason: creates an ARM CPU, thus use after free(), see - * arm_cpu_class_init() - */ - dc->cannot_destroy_with_object_finalize_yet =3D true; dc->desc =3D "i.MX25 SOC"; } =20 diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index dd1c713..d7e2d83 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -262,11 +262,6 @@ static void fsl_imx31_class_init(ObjectClass *oc, void= *data) =20 dc->realize =3D fsl_imx31_realize; =20 - /* - * Reason: creates an ARM CPU, thus use after free(), see - * arm_cpu_class_init() - */ - dc->cannot_destroy_with_object_finalize_yet =3D true; dc->desc =3D "i.MX31 SOC"; } =20 diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 76dd8a4..6969e73 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -442,11 +442,6 @@ static void fsl_imx6_class_init(ObjectClass *oc, void = *data) =20 dc->realize =3D fsl_imx6_realize; =20 - /* - * Reason: creates an ARM CPU, thus use after free(), see - * arm_cpu_class_init() - */ - dc->cannot_destroy_with_object_finalize_yet =3D true; dc->desc =3D "i.MX6 SOC"; } =20 diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index bc4e66b..4f67158 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -439,12 +439,6 @@ static void xlnx_zynqmp_class_init(ObjectClass *oc, vo= id *data) =20 dc->props =3D xlnx_zynqmp_props; dc->realize =3D xlnx_zynqmp_realize; - - /* - * Reason: creates an ARM CPU, thus use after free(), see - * arm_cpu_class_init() - */ - dc->cannot_destroy_with_object_finalize_yet =3D true; } =20 static const TypeInfo xlnx_zynqmp_type_info =3D { --=20 2.7.4 From nobody Sun Apr 28 17:05:47 2024 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 1492753330369506.37553204798155; Thu, 20 Apr 2017 22:42:10 -0700 (PDT) Received: from localhost ([::1]:57257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RKa-0006Su-Nn for importer@patchew.org; Fri, 21 Apr 2017 01:42:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RIq-0005F0-QV for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1RIm-0004RY-LK for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50690) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1RIm-0004R5-FD for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B6DD8DA28 for ; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-149.ams2.redhat.com [10.36.116.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0854E6031D; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6F76C113864B; Fri, 21 Apr 2017 07:40:13 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4B6DD8DA28 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4B6DD8DA28 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 21 Apr 2017 07:40:11 +0200 Message-Id: <1492753213-26516-3-git-send-email-armbru@redhat.com> In-Reply-To: <1492753213-26516-1-git-send-email-armbru@redhat.com> References: <1492753213-26516-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Apr 2017 05:40:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] ppc: remove cannot_destroy_with_object_finalize_yet 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: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This removes the assert(kvm_enabled()) from kvmppc_host_cpu_initfn() This assert can never be triggered as the function is only registered when KVM is available (see also 4c315c2 "qdev: Protect device-list-properties against broken devices"). So we can remove the cannot_destroy_with_object_finalize_yet from kvmppc_host_cpu_class_init() without fear and beyond reproach. (as it has already be done for i386 with 771a13e "i386: Unset cannot_destroy_with_object_finalize_yet on "host" model" and e435601 "target-i386: Remove assert(kvm_enabled()) from host_x86_cpu_initfn()") Signed-off-by: Laurent Vivier Message-Id: <20170414083717.13641-3-lvivier@redhat.com> Acked-by: Peter Maydell Acked-by: David Gibson Signed-off-by: Markus Armbruster --- target/ppc/kvm.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 9f1f132..64017ac 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2245,14 +2245,8 @@ static void alter_insns(uint64_t *word, uint64_t fla= gs, bool on) } } =20 -static void kvmppc_host_cpu_initfn(Object *obj) -{ - assert(kvm_enabled()); -} - static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data) { - DeviceClass *dc =3D DEVICE_CLASS(oc); PowerPCCPUClass *pcc =3D POWERPC_CPU_CLASS(oc); uint32_t vmx =3D kvmppc_get_vmx(); uint32_t dfp =3D kvmppc_get_dfp(); @@ -2279,9 +2273,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *o= c, void *data) if (icache_size !=3D -1) { pcc->l1_icache_size =3D icache_size; } - - /* Reason: kvmppc_host_cpu_initfn() dies when !kvm_enabled() */ - dc->cannot_destroy_with_object_finalize_yet =3D true; } =20 bool kvmppc_has_cap_epr(void) @@ -2333,7 +2324,6 @@ static int kvm_ppc_register_host_cpu_type(void) { TypeInfo type_info =3D { .name =3D TYPE_HOST_POWERPC_CPU, - .instance_init =3D kvmppc_host_cpu_initfn, .class_init =3D kvmppc_host_cpu_class_init, }; PowerPCCPUClass *pvr_pcc; --=20 2.7.4 From nobody Sun Apr 28 17:05:47 2024 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 1492753478745472.7166311567689; Thu, 20 Apr 2017 22:44:38 -0700 (PDT) Received: from localhost ([::1]:57268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RMz-0000D7-9V for importer@patchew.org; Fri, 21 Apr 2017 01:44:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RIr-0005F3-F6 for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1RIm-0004Rg-MP for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1RIm-0004R7-Ey for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:16 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 684959C0BA for ; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-149.ams2.redhat.com [10.36.116.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C60B183E3; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 729CE113864E; Fri, 21 Apr 2017 07:40:13 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 684959C0BA Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 684959C0BA From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 21 Apr 2017 07:40:12 +0200 Message-Id: <1492753213-26516-4-git-send-email-armbru@redhat.com> In-Reply-To: <1492753213-26516-1-git-send-email-armbru@redhat.com> References: <1492753213-26516-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 21 Apr 2017 05:40:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/4] versatile: remove cannot_destroy_with_object_finalize_yet 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: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier cannot_destroy_with_object_finalize_yet was added by 4c315c2 ("qdev: Protect device-list-properties against broken devices") because "realview_pci" and "versatile_pci" were hanging during "device-list-properties" cleanup (an infinite loop in bus_unparent()). We have this problem because the child is not removed from the list of the PCI bus children because it has no defined parent: qdev_set_parent_bus() set the device parent_bus pointer to bus, and adds the device in the bus children list, but doesn't update the device parent pointer. To fix the problem, move all the involved parts to the realize function. Signed-off-by: Laurent Vivier Message-Id: <20170414083717.13641-4-lvivier@redhat.com> Reviewed-by: Markus Armbruster Acked-by: Peter Maydell [Commit message tweaked] Signed-off-by: Markus Armbruster --- hw/pci-host/versatile.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index 467cbb9..27fde46 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -380,20 +380,8 @@ static void pci_vpb_reset(DeviceState *d) =20 static void pci_vpb_init(Object *obj) { - PCIHostState *h =3D PCI_HOST_BRIDGE(obj); PCIVPBState *s =3D PCI_VPB(obj); =20 - memory_region_init(&s->pci_io_space, OBJECT(s), "pci_io", 1ULL << 32); - memory_region_init(&s->pci_mem_space, OBJECT(s), "pci_mem", 1ULL << 32= ); - - pci_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), DEVICE(obj), "pci= ", - &s->pci_mem_space, &s->pci_io_space, - PCI_DEVFN(11, 0), TYPE_PCI_BUS); - h->bus =3D &s->pci_bus; - - object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_= HOST); - qdev_set_parent_bus(DEVICE(&s->pci_dev), BUS(&s->pci_bus)); - /* Window sizes for VersatilePB; realview_pci's init will override */ s->mem_win_size[0] =3D 0x0c000000; s->mem_win_size[1] =3D 0x10000000; @@ -403,10 +391,22 @@ static void pci_vpb_init(Object *obj) static void pci_vpb_realize(DeviceState *dev, Error **errp) { PCIVPBState *s =3D PCI_VPB(dev); + PCIHostState *h =3D PCI_HOST_BRIDGE(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); pci_map_irq_fn mapfn; int i; =20 + memory_region_init(&s->pci_io_space, OBJECT(s), "pci_io", 1ULL << 32); + memory_region_init(&s->pci_mem_space, OBJECT(s), "pci_mem", 1ULL << 32= ); + + pci_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), dev, "pci", + &s->pci_mem_space, &s->pci_io_space, + PCI_DEVFN(11, 0), TYPE_PCI_BUS); + h->bus =3D &s->pci_bus; + + object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_= HOST); + qdev_set_parent_bus(DEVICE(&s->pci_dev), BUS(&s->pci_bus)); + for (i =3D 0; i < 4; i++) { sysbus_init_irq(sbd, &s->irq[i]); } @@ -503,8 +503,6 @@ static void pci_vpb_class_init(ObjectClass *klass, void= *data) dc->reset =3D pci_vpb_reset; dc->vmsd =3D &pci_vpb_vmstate; dc->props =3D pci_vpb_properties; - /* Reason: object_unref() hangs */ - dc->cannot_destroy_with_object_finalize_yet =3D true; } =20 static const TypeInfo pci_vpb_info =3D { @@ -526,19 +524,10 @@ static void pci_realview_init(Object *obj) s->mem_win_size[2] =3D 0x08000000; } =20 -static void pci_realview_class_init(ObjectClass *class, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(class); - - /* Reason: object_unref() hangs */ - dc->cannot_destroy_with_object_finalize_yet =3D true; -} - static const TypeInfo pci_realview_info =3D { .name =3D "realview_pci", .parent =3D TYPE_VERSATILE_PCI, .instance_init =3D pci_realview_init, - .class_init =3D pci_realview_class_init, }; =20 static void versatile_pci_register_types(void) --=20 2.7.4 From nobody Sun Apr 28 17:05:47 2024 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 1492753330020547.8070611831052; Thu, 20 Apr 2017 22:42:10 -0700 (PDT) Received: from localhost ([::1]:57255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RKa-0006SV-9Z for importer@patchew.org; Fri, 21 Apr 2017 01:42:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1RIr-0005F2-Bu for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1RIm-0004RO-Ko for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34562) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d1RIm-0004R2-EQ for qemu-devel@nongnu.org; Fri, 21 Apr 2017 01:40:16 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 417F865CFF for ; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-149.ams2.redhat.com [10.36.116.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CFA0183E4; Fri, 21 Apr 2017 05:40:15 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 75CE2113864F; Fri, 21 Apr 2017 07:40:13 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 417F865CFF Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 417F865CFF From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 21 Apr 2017 07:40:13 +0200 Message-Id: <1492753213-26516-5-git-send-email-armbru@redhat.com> In-Reply-To: <1492753213-26516-1-git-send-email-armbru@redhat.com> References: <1492753213-26516-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 21 Apr 2017 05:40:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] qdev: remove cannot_destroy_with_object_finalize_yet 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: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier As all users have been removed, we can remove cannot_destroy_with_object_finalize_yet field from the DeviceClass structure. Signed-off-by: Laurent Vivier Message-Id: <20170414083717.13641-5-lvivier@redhat.com> Reviewed-by: Markus Armbruster Acked-by: Peter Maydell Signed-off-by: Markus Armbruster --- include/hw/qdev-core.h | 13 ------------- qmp.c | 5 ----- 2 files changed, 18 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index b44b476..ac682a6 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -113,19 +113,6 @@ typedef struct DeviceClass { * TODO remove once we're there */ bool cannot_instantiate_with_device_add_yet; - /* - * Does this device model survive object_unref(object_new(TNAME))? - * All device models should, and this flag shouldn't exist. Some - * devices crash in object_new(), some crash or hang in - * object_unref(). Makes introspecting properties with - * qmp_device_list_properties() dangerous. Bad, because it's used - * by -device FOO,help. This flag serves to protect that code. - * It should never be set without a comment explaining why it is - * set. - * TODO remove once we're there - */ - bool cannot_destroy_with_object_finalize_yet; - bool hotpluggable; =20 /* callbacks */ diff --git a/qmp.c b/qmp.c index a744e44..ab74cd7 100644 --- a/qmp.c +++ b/qmp.c @@ -548,11 +548,6 @@ DevicePropertyInfoList *qmp_device_list_properties(con= st char *typename, return NULL; } =20 - if (DEVICE_CLASS(klass)->cannot_destroy_with_object_finalize_yet) { - error_setg(errp, "Can't list properties of device '%s'", typename); - return NULL; - } - obj =3D object_new(typename); =20 object_property_iter_init(&iter, obj); --=20 2.7.4