From patchwork Wed Feb 8 02:03:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Zmudzinski X-Patchwork-Id: 13132287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22474C636CD for ; Wed, 8 Feb 2023 02:04:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.491474.760566 (Exim 4.92) (envelope-from ) id 1pPZo9-00022l-2J; Wed, 08 Feb 2023 02:03:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 491474.760566; Wed, 08 Feb 2023 02:03:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pPZo8-00022e-Us; Wed, 08 Feb 2023 02:03:36 +0000 Received: by outflank-mailman (input) for mailman id 491474; Wed, 08 Feb 2023 02:03:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pPZo7-00022Y-5c for xen-devel@lists.xenproject.org; Wed, 08 Feb 2023 02:03:35 +0000 Received: from sonic315-55.consmr.mail.gq1.yahoo.com (sonic315-55.consmr.mail.gq1.yahoo.com [98.137.65.31]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c814daab-a754-11ed-93b5-47a8fe42b414; Wed, 08 Feb 2023 03:03:31 +0100 (CET) Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Wed, 8 Feb 2023 02:03:28 +0000 Received: by hermes--production-ne1-746bc6c6c4-j9j2r (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 6c67ca8b47a829739ee46a2e499b4e4c; Wed, 08 Feb 2023 02:03:23 +0000 (UTC) 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 Sender: "Xen-devel" X-Inumbo-ID: c814daab-a754-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1675821808; bh=NXJ9PRylLClq1paqhxQPO6X19sNqGm+8vVMc3JLv+yo=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=K81FqFtOTeBnloDm8unpt8jM7HSXiSqoSjHwDxcqWTgNmGjf1tNMjn4yFltK8b6ETRdF3aYHttqINhgLyYj5WPwO14VxAVOdjrChd1Byw4yqpXq89Qnfjk++D0DXz0pACrx12qOepvsyY/jA79XPfli7K9/OyIqKPQHLDZ7t4zJXUyhJqzDWKSEh8GxyadBC8AWgTcSEzRgphOr4KnawQ5NCDsgiU+OOBSsboODTosmEaMEOVLX7Zgne2COwsTNtdSOHnDQTElT37nxv+Y6YEOTbIZ2RHzD6N3BFoO53ec644VcVi2N63a4YneXyne1kP6Nzaq25thYteDcxHdrqHQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1675821808; bh=kWlPj0khdqgamcY3cVxsxxVYNpSRMoDGw3WTDoMW/XM=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=RExVFcu4TsjeJMcqv6P/tTrkNKS71TbcVS4EHEp8CXq5PoTCnr88GqkJiQVAxAKTr2JTBAhlJrbt/BDZbG4hlkAxoD9pQer2SSDTBl8Zob/BxWevEZS68j1FS1KZpts2Iks/02TVo3q2ePgv63awwSNCDyPde9opyxNXSTn4YLe0+p84Q0JFFrtlmvukrP4tIcAj6Cq1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795.WE6gkjPoFzJlXikjxQs8.tgORiTCpmwfLtj5zZ9q.kcAMvvGGIQJt033.qmZ EyhwLQosavtEt_CM2ULZzJ0R_uecKXJd3FYRhQS4uSvMjnBzvpgEO.vDIW_5_s0atxIt8VuVHNzg TT.xUseeyax5yKWXEqKA110m0LxOp0qNtvKOYCdn5pkqUNx939atMDPUgCAjw2OW_XyvLkSd3He. 9SgLZPvwlOboR3app02mNQ3.IUSvVVaqXHwJVH3uQ_acHma4bN0.WvorHyeMrhfvAUxUrpCX65Ih o X-Sonic-MF: From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: Stefano Stabellini , Anthony Perard , Paul Durrant , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Igor Mammedov , xen-devel@lists.xenproject.org, qemu-stable@nongnu.org Subject: [PATCH] xen/pt: fix igd passthrough for pc machine with xen accelerator Date: Tue, 7 Feb 2023 21:03:05 -0500 Message-Id: X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 References: Commit 998250e97661 ("xen, gfx passthrough: register host bridge specific to passthrough") uses the igd-passthrough-i440FX pci host device with the xenfv machine type and igd-passthru=on, but using it for the pc machine type, xen accelerator, and igd-passtru=on was omitted from that commit. The igd-passthru-i440FX pci host device is also needed for guests configured with the pc machine type, the xen accelerator, and igd-passthru=on. Specifically, tests show that not using the igd-specific pci host device with the Intel igd passed through to the guest results in slower startup performance and reduced resolution of the display during startup. This patch fixes this issue. To simplify the logic that is needed to support both the --enable-xen and the --disable-xen configure options, introduce the boolean symbol pc_xen_igd_gfx_pt_enabled() whose value is set appropriately in the sysemu/xen.h header file as the test to determine whether or not to use the igd-passthrough-i440FX pci host device instead of the normal i440FX pci host device. Fixes: 998250e97661 ("xen, gfx passthrough: register host bridge specific to passthrough") Signed-off-by: Chuck Zmudzinski Acked-by: Stefano Stabellini --- This patch is intended to replace or complement a recently proposed patch that modifies slot_reserved_mask for the xenfv machine with igd-passthru=on in order to fix the problem of Qemu not reserving slot 2 for the Intel IGD for the xenfv machine type. This patch provides a simple way to improve Qemu support for the Intel IGD with the xen accelerator without needing to change how slot_reserved_mask functions. For reference, the latest version of the patch to fix the xenfv machine using slot_reserved_mask is at: https://lore.kernel.org/qemu-devel/b1b4a21fe9a600b1322742dda55a40e9961daa57.1674346505.git.brchuckz@aol.com/ Reason for introducing the new boolean pc_xen_igd_gfx_pt_enabled(): It is also possible to use xen_igd_gfx_pt_enabled() directly to check if the igd-passthru-i440FX pci host device is needed in this patch, but in that case it would be necessary to implement it in accel/stubs/xen-stub.c like this: bool xen_igd_gfx_pt_enabled(void) { return false; } to cover the case when Qemu is configured with --disable-xen. I thought it was simpler to introduce the same boolean prefixed with pc_ and set it to 0 when --disable-xen is the configure option, and that explains why the proposed patch introduces pc_xen_igd_gfx_pt_enabled() instead of using xen_igd_gfx_pt_enabled() directly. Another reason to use pc_xen_igd_gfx_pt_enabled() is to distinguish it from xen_igd_gfx_pt_enabled() in hw/i386/pc_piix.c, because the use of xen_igd_gfx_pt_enabled() is guarded by CONFIG_XEN but this patch needs to place the boolean in a position that is not guarded by CONFIG_XEN. This approach will simplify any future effort to move the code in pc_piix.c that is not guarded by CONFIG_XEN to a xen-specific file. hw/i386/pc_piix.c | 2 ++ include/sysemu/xen.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index df64dd8dcc..fd5b9ae1eb 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -433,6 +433,8 @@ static void pc_xen_hvm_init(MachineState *machine) compat(machine); \ } \ pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \ + pc_xen_igd_gfx_pt_enabled() ? \ + TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE : \ TYPE_I440FX_PCI_DEVICE); \ } \ DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn) diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h index 0ca25697e4..99ae41e619 100644 --- a/include/sysemu/xen.h +++ b/include/sysemu/xen.h @@ -23,6 +23,7 @@ extern bool xen_allowed; #define xen_enabled() (xen_allowed) +#define pc_xen_igd_gfx_pt_enabled() xen_igd_gfx_pt_enabled() #ifndef CONFIG_USER_ONLY void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length); @@ -33,6 +34,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, #else /* !CONFIG_XEN_IS_POSSIBLE */ #define xen_enabled() 0 +#define pc_xen_igd_gfx_pt_enabled() 0 #ifndef CONFIG_USER_ONLY static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) {