From nobody Sun Feb 8 21:38:29 2026 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1657028847; cv=none; d=zohomail.com; s=zohoarc; b=VyMrvjwtcaKyi4iWXok2agGoL/laNADiViqWUCIwoObN6qDMYe4hHMziaAkUtmmmSbFs0dkGocmTvZWqnQRstHwvc/5yaGHJEfey5FBRx7S5nrhUXfnGT5ttmDpyBB5WmNNwkaLFKtkK086kSNu/Lj/17twXFbncYCa31gjQemg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657028847; h=Content-Type: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:Reply-To:References:Sender:Subject:To; bh=NY+p3IklGBQ5lgr43ujAhz7HvSN9qhLe1q1x1m5ItYg=; b=gjpo7FzISQs5NgEQYAZ/ZQuK4okrkuF9/EylaogDP/XrGG1rTtucb5HlVmukJNDIiOEaDvl3y7VVuySrkQ2HcUlXmoluxU/I8gcVDOfG7YeS2CzdnAbZ1+iDFwCJrrO/ermN6xTP27uD28sa797LZ3tqRX0sGL1lSopFrQalRs4= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657028847259526.1125118847941; Tue, 5 Jul 2022 06:47:27 -0700 (PDT) Received: from localhost ([::1]:52672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8itg-00008T-Ro for importer@patchew.org; Tue, 05 Jul 2022 09:47:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8isO-00076f-Uk for qemu-devel@nongnu.org; Tue, 05 Jul 2022 09:46:04 -0400 Received: from esa5.hc3370-68.iphmx.com ([216.71.155.168]:6591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8isJ-0005vu-VZ for qemu-devel@nongnu.org; Tue, 05 Jul 2022 09:46:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1657028759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WAaH1Hoy9an/j21GpNiS97JhuDSNqD7IvsL6S23dqts=; b=TyVlaNcPk0htvBWgqGKgg85LovTF/UWHXQHlAmnWADb+uHaNHJfwInWb qScylOky8o4AJH5b+qQPP7VGqIZTVLWAapWJjYoJ2enT8yYyXqa5nU84G eLfv7rjvJn/znhtXTmxAm5SY9FgV965gDs/OR1eV0YUUKXYUYvwFzoPI7 A=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 74420398 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:EGOe7qzNGJJIUVDYnzp6t+eNxyrEfRIJ4+MujC+fZmUNrF6WrkUCz GcYUGHVb/+KZzOhL9hxad+z/R9Q6pfSyIQxG1ds+SAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX1JZS5LwbZj2NY32YXhWWthh PupyyHhEA79s9JLGjp8B5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udzinski , Anthony PERARD Subject: [PULL 1/2] xen/pass-through: merge emulated bits correctly Date: Tue, 5 Jul 2022 14:45:35 +0100 Message-ID: <20220705134536.11109-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220705134536.11109-1-anthony.perard@citrix.com> References: <20220705134536.11109-1-anthony.perard@citrix.com> 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=216.71.155.168; envelope-from=prvs=1787b3430=anthony.perard@citrix.com; helo=esa5.hc3370-68.iphmx.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Anthony PERARD From: Anthony PERARD via X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1657028848513100003 Content-Type: text/plain; charset="utf-8" From: Chuck Zmudzinski In xen_pt_config_reg_init(), there is an error in the merging of the emulated data with the host value. With the current Qemu, instead of merging the emulated bits with the host bits as defined by emu_mask, the emulated bits are merged with the host bits as defined by the inverse of emu_mask. In some cases, depending on the data in the registers on the host, the way the registers are setup, and the initial values of the emulated bits, the end result will be that the register is initialized with the wrong value. To correct this error, use the XEN_PT_MERGE_VALUE macro to help ensure the merge is done correctly. This correction is needed to resolve Qemu project issue #1061, which describes the failure of Xen HVM Linux guests to boot in certain configurations with passed through PCI devices, that is, when this error disables instead of enables the PCI_STATUS_CAP_LIST bit of the PCI_STATUS register of a passed through PCI device, which in turn disables the MSI-X capability of the device in Linux guests with the end result being that the Linux guest never completes the boot process. Fixes: 2e87512eccf3 ("xen/pt: Sync up the dev.config and data values") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1061 Buglink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D988333 Signed-off-by: Chuck Zmudzinski Reviewed-by: Anthony PERARD Message-Id: Signed-off-by: Anthony PERARD --- hw/xen/xen_pt_config_init.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index c5c4e943a8..bff0962795 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -1965,11 +1965,12 @@ static void xen_pt_config_reg_init(XenPCIPassthroug= hState *s, =20 if ((data & host_mask) !=3D (val & host_mask)) { uint32_t new_val; - - /* Mask out host (including past size). */ - new_val =3D val & host_mask; - /* Merge emulated ones (excluding the non-emulated ones). */ - new_val |=3D data & host_mask; + /* + * Merge the emulated bits (data) with the host bits (val) + * and mask out the bits past size to enable restoration + * of the proper value for logging below. + */ + new_val =3D XEN_PT_MERGE_VALUE(val, data, host_mask) & size_ma= sk; /* Leave intact host and emulated values past the size - even = though * we do not care as we write per reg->size granularity, but f= or the * logging below lets have the proper value. */ --=20 Anthony PERARD From nobody Sun Feb 8 21:38:29 2026 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1657028935; cv=none; d=zohomail.com; s=zohoarc; b=aaHBTKMjiD5PaatyPbViM39SjWeV+7HltUDP2N/RWS3ONf0f1E6zpNNLMh5NsgxwGTjAIarndC5NHedls6/p5+qY5lBU229dQxdDwb9uNZiGYDDldAKbBjCO28mri0PK9oZIGUzXXoCgEZVZHI4N6X4VE7cMTH8y5RsLtqN9ByI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657028935; h=Content-Type: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:Reply-To:References:Sender:Subject:To; bh=tv5mPnWMoLlwvCj+0P8bswVvJBW4pe/nYwKXW5ZW9aM=; b=hqfYRVPEH5Cr6RVGmhV6v1vGWNFxxd7z2Ftdp6wcEICGV6orXpS+O9GdUtMIF8qllJk9jsGaAdg9Tpc9TgHKXJkDMD0KvvrZ09lo+N+fRRF4sdb3zThwBvocRfG0/3wz9kB4uI6Wra3r5+uSlv9da2Gq60G8BOLhDehneMzRmi0= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657028935132827.3572519934669; Tue, 5 Jul 2022 06:48:55 -0700 (PDT) Received: from localhost ([::1]:55900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8iv7-0002LG-3R for importer@patchew.org; Tue, 05 Jul 2022 09:48:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8isP-00076Z-OR for qemu-devel@nongnu.org; Tue, 05 Jul 2022 09:46:05 -0400 Received: from esa5.hc3370-68.iphmx.com ([216.71.155.168]:6624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8isJ-0005wz-Vy for qemu-devel@nongnu.org; Tue, 05 Jul 2022 09:46:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1657028759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yT6KNIJQJEoqKl4wrtQzwF8LV9QhT3QxrgguEPH6E7Y=; b=Ptm7+r0YdO102kBFyjLnvSWyzMbXScIokJAEAVJSijtzISTez80UII/y 7+oSmsfH739Sq3VqQmutTRojJjerLRB+MZzxx5znN+uNm5TEstGUzMP1q Dww0hQezzbva+5nMXm2l1zhGdP9YiElZb/BnOp3N/wA612qPIxGnBCDFE 4=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 74420399 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:tMJl46y3mW+yCi3o0p96t+eNxyrEfRIJ4+MujC+fZmUNrF6WrkVRn 2MYWjjQP/uNNDT1fNxzPIyw9BlXu8PdzoRgT1Fv/iAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX1JZS5LwbZj2NY32YXhWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Nplr7iZYjY2brz2ofkwbyRbTyJ1IZRo9+qSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DNYUDunZm3HfBAOwvW5zrSKTW/95Imjw3g6iiGN6BO 5ZDMWE+PXwsZTVJIFxIT4Ixgt6yi2vvdAMAhFGUgbU4tj27IAtZj+G2bYu9lsaxbc9PlUaFr WHU123+BlcRM9n34SOI92/piuLRkCfTXoUUG7ulsPlwjzWuKnc7UUNMEwHh+L/g1xD4C4k3x 1EoFjQGt4wb3320HsjHZgCVnEOH4h0XR+N+HLhvgO2S8ZY48zp1F0BdEGMfNod35Z5vLdA5/ gTXxo20XFSDpJXQECvArenM8FteLABPdQc/iTk4oRzpCjUJiKU6lVrxQ9lqC8ZZZfWlSGirk 1hmQMXT7oj/bPLnNI3hpDgrexr2+vD0ovcdv207pF6N4AJjf5KCbIe181Xd5vsoBN/HEwfQ4 SlUwpnCtLlm4XSxeMulGbxlIV1Uz6zdbG20baBHRfHNCAhBC1b8JNsNsVmS1W9iM9oeeC+BX XI/TTh5vccJVFPzNPcfS9voV6wCkPm7ffy4B6+8Uza7SsUoHONx1Ho2NRD4MqGEuBVErJzTz r/CLpnzVy5EVv43pNd0Ls9EuYIWKukF7Tu7bfjGI96PiNJyuFb9pW85DWaz IronPort-HdrOrdr: A9a23:E0W2h6i9V1Dtztc4Wm8aBwvKiXBQXtwji2hC6mlwRA09TySZ// rAoB19726StN9xYgBYpTnuAsi9qB/nmKKdpLNhX4tKPzOW3FdATrsD0WKK+VSJcEfDH6xmpM JdmsBFebvN5DNB4/oSjjPVLz9Z+qjlzJyV X-IronPort-AV: E=Sophos;i="5.92,247,1650945600"; d="scan'208";a="74420399" To: CC: Chuck Zmudzinski , Anthony PERARD Subject: [PULL 2/2] xen/pass-through: don't create needless register group Date: Tue, 5 Jul 2022 14:45:36 +0100 Message-ID: <20220705134536.11109-3-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220705134536.11109-1-anthony.perard@citrix.com> References: <20220705134536.11109-1-anthony.perard@citrix.com> 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=216.71.155.168; envelope-from=prvs=1787b3430=anthony.perard@citrix.com; helo=esa5.hc3370-68.iphmx.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Anthony PERARD From: Anthony PERARD via X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1657028935426100001 Content-Type: text/plain; charset="utf-8" From: Chuck Zmudzinski 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 Message-Id: Signed-off-by: Anthony PERARD --- 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 bff0962795..4758514ddf 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -2032,12 +2032,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 Anthony PERARD