From nobody Fri Apr 26 19:53:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1593001145; cv=none; d=zohomail.com; s=zohoarc; b=BvkW5x+uH6DgFi19NuEyC1UmVGSzZnz0YkoeMp3FaKu9b6lZ7vK2dIbO1GnPfuuxLw7FG9qYzWhHW4rEkljdkYuA7AcVAO4FTIJ07orwHK4B9lcajiY14zc5cGjlqDlKHuu8rffRiDYqrddoZWvnAZ5i/wkrs17eXvPMQ6lhkWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593001145; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N/I4v8ZDmbVyJ5v5uM4VjOF7rLFaxzrV35vC/IJzksA=; b=B8xmlqPB2swS/esxzLjypIgFaofJ6lKUu06m1Db2LJ+m+FtygiY273X0Z/+ndG6X67bkS0etLA+nPn6bYRQxsdT6Pq1QzNlHD2ZCuN530rPA9pPCaOK4hLGaYtPwdqdekJWgQefcl7x2Sk4QsNvs7Sl5X/pVIFRaG0m6O++fPW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1593001145207610.8990976234833; Wed, 24 Jun 2020 05:19:05 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jo4Mb-00067y-SG; Wed, 24 Jun 2020 12:18:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jo4MZ-00067X-VR for xen-devel@lists.xenproject.org; Wed, 24 Jun 2020 12:18:48 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d9cd1730-b614-11ea-80a5-12813bfff9fa; Wed, 24 Jun 2020 12:18:45 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jo4MX-0000gD-A9; Wed, 24 Jun 2020 12:18:45 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=u2f063a87eabd5f.cbg10.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jo4MX-0005fi-17; Wed, 24 Jun 2020 12:18:45 +0000 X-Inumbo-ID: d9cd1730-b614-11ea-80a5-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=N/I4v8ZDmbVyJ5v5uM4VjOF7rLFaxzrV35vC/IJzksA=; b=lLt2C+uuKQnj7hdrvVOUwqTmOc 6mvivoKpj2mcC21dDbNQfw4TWLRKSULpTUGgzd25DC8kwHlqRizrzV3HUR9DbL5N4J3sjdFzS7+Rl cRCyHUZbwb3LjveMQRyODxZQ2B1ueU6ynTq2P9rKxbofMWbp9V8guYfzhYMH+HyZu39s=; From: Paul Durrant To: xen-devel@lists.xenproject.org, qemu-devel@nongnu.org Subject: [PATCH 1/2] xen: fix legacy 'xen-sysdev' and 'xen-backend' bus types Date: Wed, 24 Jun 2020 13:18:40 +0100 Message-Id: <20200624121841.17971-2-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200624121841.17971-1-paul@xen.org> References: <20200624121841.17971-1-paul@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , Paul Durrant , Stefano Stabellini , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Paul Durrant 'xen-sysdev' plugs into the 'System' bus type, not 'xen-sysbus. That bus ty= pe is what 'xen-backend' plugs into. 'xen-sysdev' is drived form 'sys-bus-device' so the bus type need not be overridden. 'xen-backend' is derived from 'device', which plugs into the generic 'bus' type, so its bus type should be overridden to 'xen-sysbus'. Without this patch, the following assertion will fail: qemu-system-i386: hw/core/qdev.c:102: qdev_set_parent_bus: Assertion `dc->bus_type && object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed. Reported-by: Jason Andryuk Fixes: 81cb05732efb ("qdev: Assert devices are plugged into a bus that can = take them") Signed-off-by: Paul Durrant Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Cc: Stefano Stabellini Cc: Anthony Perard --- hw/xen/xen-legacy-backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c index 2335ee2e65..c5c75c0064 100644 --- a/hw/xen/xen-legacy-backend.c +++ b/hw/xen/xen-legacy-backend.c @@ -789,11 +789,12 @@ static void xendev_class_init(ObjectClass *klass, voi= d *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); /* xen-backend devices can be plugged/unplugged dynamically */ dc->user_creatable =3D true; + dc->bus_type =3D TYPE_XENSYSBUS; } =20 static const TypeInfo xendev_type_info =3D { .name =3D TYPE_XENBACKEND, - .parent =3D TYPE_XENSYSDEV, + .parent =3D TYPE_DEVICE, .class_init =3D xendev_class_init, .instance_size =3D sizeof(struct XenLegacyDevice), }; @@ -824,7 +825,6 @@ static void xen_sysdev_class_init(ObjectClass *klass, v= oid *data) DeviceClass *dc =3D DEVICE_CLASS(klass); =20 device_class_set_props(dc, xen_sysdev_properties); - dc->bus_type =3D TYPE_XENSYSBUS; } =20 static const TypeInfo xensysdev_info =3D { --=20 2.20.1 From nobody Fri Apr 26 19:53:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1593001217; cv=none; d=zohomail.com; s=zohoarc; b=mf+0cZWF2MqG0tmUMfVHNuhpI22iG4Xrm6w6pDPn1gYta39V4qro2/NWb2RAn72TQicTSif/r3Nlc7YX6b9l+jHKQf0e3eag391FUZ2TCCweeqFOVleOEvLDJdD0mwSoepLgRqj/z3rPm9kSSLXPOAzrippXjleGUNZB9OdLJos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593001217; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WmkzEFnsGIT7sjSL+1trW0fIwoGyCpkoOnXxvyuh+2I=; b=EyLiau/BOK44aFJjNQTs3SlxxUWlysQd4hNYRDAfIPNn9Wrh75BuOiTOlxVRaebMhF34r0o/CA4/Ffxy9cqMt4jY6pDy6PVXnSLZAYJW3PBFQiJHPNQVsVFdFykYBMkE8fo/l0SrRpM+mXXJLtmFK6TVsR3MB4xMx94aeRAMFuo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593001217237823.5516837223128; Wed, 24 Jun 2020 05:20:17 -0700 (PDT) Received: from localhost ([::1]:42648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jo4Nz-0002wr-VE for importer@patchew.org; Wed, 24 Jun 2020 08:20:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jo4Md-0001iq-JG for qemu-devel@nongnu.org; Wed, 24 Jun 2020 08:18:51 -0400 Received: from mail.xenproject.org ([104.130.215.37]:41822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jo4Mb-0004Uj-84 for qemu-devel@nongnu.org; Wed, 24 Jun 2020 08:18:51 -0400 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jo4MY-0000gH-PN; Wed, 24 Jun 2020 12:18:46 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=u2f063a87eabd5f.cbg10.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jo4MY-0005fi-Gg; Wed, 24 Jun 2020 12:18:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WmkzEFnsGIT7sjSL+1trW0fIwoGyCpkoOnXxvyuh+2I=; b=IMWSEnAp8h0F/2AJelrjK/lD5Y XytjbgEbImgRnLyGQ1m8zFKYjRqaaP1EodKbhHxbGcHS3a6n26wzRt057a6vY5aGHuLNVPhaWrr58 DzqCQmQuICWD58fsq5dry+Lf4PBdal4NM1X+u+cyrn22+nVRmKBWVY0Ggj1hrWaINn34=; From: Paul Durrant To: xen-devel@lists.xenproject.org, qemu-devel@nongnu.org Subject: [PATCH 2/2] xen: cleanup unrealized flash devices Date: Wed, 24 Jun 2020 13:18:41 +0100 Message-Id: <20200624121841.17971-3-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200624121841.17971-1-paul@xen.org> References: <20200624121841.17971-1-paul@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=104.130.215.37; envelope-from=paul@xen.org; helo=mail.xenproject.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 08:18:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Paul Durrant , Jason Andryuk , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Paul Durrant The generic pc_machine_initfn() calls pc_system_flash_create() which creates 'system.flash0' and 'system.flash1' devices. These devices are then realized by pc_system_flash_map() which is called from pc_system_firmware_init() whi= ch itself is called via pc_memory_init(). The latter however is not called when xen_enable() is true and hence the following assertion fails: qemu-system-i386: hw/core/qdev.c:439: qdev_assert_realized_properly: Assertion `dev->realized' failed These flash devices are unneeded when using Xen so this patch avoids the assertion by simply removing them using pc_system_flash_cleanup_unused(). Reported-by: Jason Andryuk Fixes: ebc29e1beab0 ("pc: Support firmware configuration with -blockdev") Signed-off-by: Paul Durrant Tested-by: Jason Andryuk Reviewed-by: Anthony PERARD Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: "Michael S. Tsirkin" Cc: Marcel Apfelbaum --- hw/i386/pc_piix.c | 9 ++++++--- hw/i386/pc_sysfw.c | 2 +- include/hw/i386/pc.h | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1497d0e4ae..977d40afb8 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -186,9 +186,12 @@ static void pc_init1(MachineState *machine, if (!xen_enabled()) { pc_memory_init(pcms, system_memory, rom_memory, &ram_memory); - } else if (machine->kernel_filename !=3D NULL) { - /* For xen HVM direct kernel boot, load linux here */ - xen_load_linux(pcms); + } else { + pc_system_flash_cleanup_unused(pcms); + if (machine->kernel_filename !=3D NULL) { + /* For xen HVM direct kernel boot, load linux here */ + xen_load_linux(pcms); + } } =20 gsi_state =3D pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index ec2a3b3e7e..0ff47a4b59 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -108,7 +108,7 @@ void pc_system_flash_create(PCMachineState *pcms) } } =20 -static void pc_system_flash_cleanup_unused(PCMachineState *pcms) +void pc_system_flash_cleanup_unused(PCMachineState *pcms) { char *prop_name; int i; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e6135c34d6..497f2b7ab7 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -187,6 +187,7 @@ int cmos_get_fd_drive_type(FloppyDriveType fd0); =20 /* pc_sysfw.c */ void pc_system_flash_create(PCMachineState *pcms); +void pc_system_flash_cleanup_unused(PCMachineState *pcms); void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memor= y); =20 /* acpi-build.c */ --=20 2.20.1