From nobody Tue Feb 10 06:58:37 2026 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=pass; 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=1678213668; cv=none; d=zohomail.com; s=zohoarc; b=KJ38byfQHDGP848U9ydmkEfvLOIEMg8DyPPJ1GGo5PJzQ/nyOiXd6Ib8HQGgV56y5xedeQRw2qOyWGsUqbH1mfo979jQgmmjKjHBHSuPT1Y75t7aE8B/C26cgKnMj5rBGkY2fFJSlvpzQ4em7IcNwhrobw61kX/K4WeqvTbYTPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678213668; 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=4BkL9NyCgm8G9JQUlKfpShNc/FIh4cWQeRocuey9tU8=; b=HTF9H5rtbUnq4d+xV9pZyPyA+l7a0TDN+Wop7HoexNYgsybismimfUXQO0zCpinC1Vplm3CQRC0UVNI1B8qoY67sLNAWwLFFPCN/TJUFREsnAejmi0nzx/v2dMitegZCVpVb+rpgoeoMoz4C+//dWfyYWDw5SPLzUUNtz8SNSWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 16782136680076.5434301492200575; Tue, 7 Mar 2023 10:27:48 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.507788.781874 (Exim 4.92) (envelope-from ) id 1pZc28-0005HL-Sh; Tue, 07 Mar 2023 18:27:32 +0000 Received: by outflank-mailman (output) from mailman id 507788.781874; Tue, 07 Mar 2023 18:27:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pZc28-0005Dy-5G; Tue, 07 Mar 2023 18:27:32 +0000 Received: by outflank-mailman (input) for mailman id 507788; Tue, 07 Mar 2023 18:27:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pZc22-0002M9-V9 for xen-devel@lists.xenproject.org; Tue, 07 Mar 2023 18:27:26 +0000 Received: from desiato.infradead.org (desiato.infradead.org [2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b283b266-bd15-11ed-96b5-2f268f93b82a; Tue, 07 Mar 2023 19:27:20 +0100 (CET) Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pZc1o-00H8TO-0z; Tue, 07 Mar 2023 18:27:12 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pZc1o-009e9z-0d; Tue, 07 Mar 2023 18:27:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: b283b266-bd15-11ed-96b5-2f268f93b82a DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=4BkL9NyCgm8G9JQUlKfpShNc/FIh4cWQeRocuey9tU8=; b=RIvuthfM3LePc4AF2k/q1ZUhW4 5zwFziqjGtLVihO9L4u9rNjPMbkQDVU/Jh9Li3talXnatPaKfOdniUGtk2u68q+aTaLeEJcCSAe9V 6Q9UFxPrF22tFeva9qdYiUWtbwJaBpAMhH5/K2+SW9Ir7AiR06Xds4AitMTCZ+xE7GuZV4fq18zuc eW6cw2GL4nJHNOoWioOUBIN3yPyjMKzA98MGZjSUgwWjmlgdRRGG9v3hIX1a2cAsZp4ertYzy715E x701p1GokKdWOW3TIIwX9GGYmhuSTuUGS9e6VD4ZDtP82gOyWFuuKDxsf3sBPUxvxFCYsK+BCtbpy AKikh7pg==; From: David Woodhouse To: Peter Maydell Cc: qemu-devel@nongnu.org, Paolo Bonzini , Paul Durrant , Joao Martins , Ankur Arora , Stefano Stabellini , vikram.garhwal@amd.com, Anthony Perard , xen-devel@lists.xenproject.org, Juan Quintela , "Dr . David Alan Gilbert" Subject: [PULL 25/27] i386/xen: Initialize Xen backends from pc_basic_device_init() for emulation Date: Tue, 7 Mar 2023 18:27:05 +0000 Message-Id: <20230307182707.2298618-26-dwmw2@infradead.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230307182707.2298618-1-dwmw2@infradead.org> References: <20230307182707.2298618-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1678213668498100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Now that all the work is done to enable the PV backends to work without actual Xen, instantiate the bus from pc_basic_device_init() for emulated mode. This allows us finally to launch an emulated Xen guest with PV disk. qemu-system-x86_64 -serial mon:stdio -M q35 -cpu host -display none \ -m 1G -smp 2 -accel kvm,xen-version=3D0x4000a,kernel-irqchip=3Dsplit \ -kernel bzImage -append "console=3DttyS0 root=3D/dev/xvda1" \ -drive file=3D/var/lib/libvirt/images/fedora28.qcow2,if=3Dnone,id=3Ddi= sk \ -device xen-disk,drive=3Ddisk,vdev=3Dxvda If we use -M pc instead of q35, we can even add an IDE disk and boot a guest image normally through grub. But q35 gives us AHCI and that isn't unplugged by the Xen magic, so the guests ends up seeing "both" disks. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/pc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7bebea57e3..1489abf010 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -102,6 +102,11 @@ #include "trace.h" #include CONFIG_DEVICES =20 +#ifdef CONFIG_XEN_EMU +#include "hw/xen/xen-legacy-backend.h" +#include "hw/xen/xen-bus.h" +#endif + /* * Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. @@ -1318,6 +1323,8 @@ void pc_basic_device_init(struct PCMachineState *pcms, if (pcms->bus) { pci_create_simple(pcms->bus, -1, "xen-platform"); } + xen_bus_init(); + xen_be_init(); } #endif =20 --=20 2.39.0