From nobody Tue May 7 02:27:03 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=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; dmarc=pass(p=reject dis=none) header.from=aol.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1656482701097357.30969513757304; Tue, 28 Jun 2022 23:05:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.357534.586135 (Exim 4.92) (envelope-from ) id 1o6QoT-00051X-Pj; Wed, 29 Jun 2022 06:04:33 +0000 Received: by outflank-mailman (output) from mailman id 357534.586135; Wed, 29 Jun 2022 06:04:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o6QoT-00051Q-ND; Wed, 29 Jun 2022 06:04:33 +0000 Received: by outflank-mailman (input) for mailman id 357534; Wed, 29 Jun 2022 06:04:32 +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 1o6QoS-00051I-K2 for xen-devel@lists.xenproject.org; Wed, 29 Jun 2022 06:04:32 +0000 Received: from sonic314-21.consmr.mail.gq1.yahoo.com (sonic314-21.consmr.mail.gq1.yahoo.com [98.137.69.84]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 562eed8f-f771-11ec-bd2d-47488cf2e6aa; Wed, 29 Jun 2022 08:04:30 +0200 (CEST) Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Wed, 29 Jun 2022 06:04:28 +0000 Received: by hermes--production-ne1-7864dcfd54-q4948 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 2814da2f277392d570820fdc55e6888d; Wed, 29 Jun 2022 06:04:25 +0000 (UTC) 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 Sender: "Xen-devel" X-Inumbo-ID: 562eed8f-f771-11ec-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1656482668; bh=zXI8lOjk5jak20Wr8hBYS9pShh6LSGwvLeCNZDO/jUI=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=VDftd59DYcE9LQ5W+YhKifpwd9op51H4T/Uvvt6NlnIXT46SOIZ9vv6j7NbFcaBDWHWjcXRpPREm+Dn96WZWqs8ZzvbsZaViMvnW60snqFBdQj9T417tXWQheM+7u8I/HXWymBl9n3TP7FAoOsj2MO+rpIEc7IlocQRGLq/RBP4hAENrIHDUY1Eob2aRr8h/GDoILLOK3sFtvKUP5kFR1mZZfXeYQvjBMayccfcyTWR639HaFS6vEFszPV/IHzcVfLsbKAnBnMGf4mwwhvJRE/kHEju3XZBP5wzLhEuGTEVZCTsmiMFh+lnxgzMSvWzIgXRBYPzX6oqYB7Se7ITM3g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1656482668; bh=LkoGCfHrTahP0imugLWlseCDSzbQlQ262ug1rjpAhv0=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=ZiuGxlcj9Mmr1Su7jtfgyvesfzMIyg/H/UDS19SDoXnwURDVkERYIxCU3XA+DDkd8GwSv6BK4p1rujVWNJBHjhKbLjSjvZK/QghwAuloJuSGRgLJa7tMQuzLzoLITgdlC1kkUV8VwbHzlxRp7mPis5dhUYRXmpPlHM6O9w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t8H2 6MCF8CxZXnpLEgivV4RRw4gRWW_JPNHcp8Bhx7YivwJFbnBYmc2BUuITR1VBWo.1RBDCRma_.zgd 3KIuTKpBZ3sZEwtD0qLGmVZk1eLNVDl_aPitugeI4qat_veRLH1eA4xQai8hNAkLMjqCI.buzHEY SfkTKyG1RRgj9Zw97mnM.gdTAZsFfCRi4gm5XvrE0G6.K7hcWmwKJ9j4VOCn6QoA6R.4EbvisqTz ra_p7oGmZ61PMzMWCWPtjHDwUh7oOjmevTI3DXE2JUKnMQbkL6a8eiLlyw_dagzemYuQuUJ8- X-Sonic-MF: From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org, qemu-trivial@nongnu.org, qemu-stable@nongnu.org, Stefano Stabellini , Anthony Perard , Paul Durrant Subject: [PATCH v3] xen/pass-through: don't create needless register group Date: Wed, 29 Jun 2022 02:04:05 -0400 Message-Id: X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable References: Content-Length: 2635 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1656482702377100001 Content-Type: text/plain; charset="utf-8" Currently we are creating a register group for the Intel IGD OpRegion for every device we pass through, but the XEN_PCI_INTEL_OPREGION register group is only valid for an Intel IGD. Add a check to make sure the device is an Intel IGD and a check that the administrator has enabled gfx_passthru in the xl domain configuration. Require both checks to be true before creating the register group. Use the existing is_igd_vga_passthrough() function to check for a graphics device from any vendor and that the administrator enabled gfx_passthru in the xl domain configuration, but further require that the vendor be Intel, because only Intel IGD devices have an Intel OpRegion. These are the same checks hvmloader and libxl do to determine if the Intel OpRegion needs to be mapped into the guest's memory. Also, move the comment about trapping 0xfc for the Intel OpRegion where it belongs after applying this patch. Signed-off-by: Chuck Zmudzinski Reviewed-by: Anthony PERARD --- v2: * Move the comment to an appropriate place after applying this patch * Mention that the comment is moved in the commit message v2 addresses the comment by Anthony Perard on the original version of this patch. v3: * Add Reviewed-By: Anthony Perard * Add qemu-stable@nongnu.org to recipients to indicate the patch may be suitable for backport to Qemu stable Thank you, Anthony, for taking the time to review this patch. hw/xen/xen_pt_config_init.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index c5c4e943a8..cad4aeba84 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -2031,12 +2031,16 @@ void xen_pt_config_init(XenPCIPassthroughState *s, = Error **errp) } } =20 - /* - * By default we will trap up to 0x40 in the cfg space. - * If an intel device is pass through we need to trap 0xfc, - * therefore the size should be 0xff. - */ if (xen_pt_emu_reg_grps[i].grp_id =3D=3D XEN_PCI_INTEL_OPREGION) { + if (!is_igd_vga_passthrough(&s->real_device) || + s->real_device.vendor_id !=3D PCI_VENDOR_ID_INTEL) { + continue; + } + /* + * By default we will trap up to 0x40 in the cfg space. + * If an intel device is pass through we need to trap 0xfc, + * therefore the size should be 0xff. + */ reg_grp_offset =3D XEN_PCI_INTEL_OPREGION; } =20 --=20 2.36.1