From nobody Sun May 19 09:23:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=reject dis=none) header.from=aol.com ARC-Seal: i=1; a=rsa-sha256; t=1654895559; cv=none; d=zohomail.com; s=zohoarc; b=CBkhGXLRHlX8eH0G8kZ4t2xR4UmOYuwNnjWJ2SV2WNXY1fsT6nPT/36Ulcwro5bdv+cFxGevQVXYet1Sjc0k0u3SqFSqVl1qoxoRHo6sx+hSPnlVDRTE2rdAQeCqllt0u7ezKtPFagnHMlrxjfq0LgH/BrJ2dUtScXjNnNUs1UA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654895559; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=szQQXgwdpNsXgDZ8HmI7zcWajUugI4/mSs4RjBC4WHA=; b=EH4Jp/j5F4Zbt901LbdFRMKpnPA66Qf/P4qIyKIRqbWf1JVhrbX8XpWwM48UkbOAPkQnW01DsCRME9AzXn58C4mqnTdh6WKAOOFUuIw2y59AKL0syejmLbS5xhuVnJ1l+a7XfYFdFIj1/J9H/QdIxR5ERWOyvXDAcBFWTHF69nA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654895559585950.8967265053772; Fri, 10 Jun 2022 14:12:39 -0700 (PDT) Received: from localhost ([::1]:36172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzlvq-0005jx-Ec for importer@patchew.org; Fri, 10 Jun 2022 17:12:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzk2Q-00011A-Dg for qemu-devel@nongnu.org; Fri, 10 Jun 2022 15:11:18 -0400 Received: from sonic313-20.consmr.mail.gq1.yahoo.com ([98.137.65.83]:44587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzk2M-0002wz-NM for qemu-devel@nongnu.org; Fri, 10 Jun 2022 15:11:17 -0400 Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Fri, 10 Jun 2022 19:11:10 +0000 Received: by hermes--canary-production-bf1-856dbf94db-29hkj (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9d6f995788e29b021bb644e07662bfe3; Fri, 10 Jun 2022 19:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1654888270; bh=szQQXgwdpNsXgDZ8HmI7zcWajUugI4/mSs4RjBC4WHA=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=duqtH943Dlyju92svX3AFoc3OSDY/43X3Hgu2OgwUAV0o+1z0A5EukqnBjeacRY6CLlgAEetJn4gQc57vjpNXDdF4txnBu+EkAUFQw4Pg4DV4isbM+GXCTJGs1fwCLhOm7RpsZI2ZiJ12lkkmo9DP+hxl8PsE8hDoPBPCKFzsvRjCO4/nL5IwAy9DbGDVTwJdifKJY9hixEpLa/pf4gq73ZpU6XlDFQeoRUmUKMVecE+sQEgyMk/xIn/pK9ACj+FeuePV2YGFSImdBDnTXjekyDJvXDY6ab/rfWQthP6+vaw0xARRtXhR42JVuxK1hQJgfwjmfmOx2JaiKM6r9h2vA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1654888270; bh=58rsgOgWzfRp11yAmimyUtsHGChA3r+y5aL6LGS3EoG=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=aeh+IS/kWViQ2K5fNMH2tFb1Xsamjmi/unryJA+DqFktY+iS3OAfA3Bd7sDl5lS+ftuIdVDlZf0nwfzvooY5wRkBF3GO34wmyEyoR2usPoGPrxCPpaKpoEn+mIw2XEQuzGI98ELB7Cyday4ifW7Q9CEUzIXlFFZDTz0NGVrKTlAb5vhYc7l1Bi/JgsaoDUP3EzS1g7JynGmhbdXQ0hliH3ghi/u5/kl2uiW/G5XQzMlunK59RNHbsLw/nrsmYd7FN7j+5n12cH5Q9lTLtR9m9e9Jq9yZfIZUJwuyKD5TLlSfm/xDWSAmbo6K10qKm5gPNeCSG71TKbg4niuQcIIJfg== X-YMail-OSG: EcVWYf0VM1kaBprv3wOo91pcd4NE_dHn3XGuYnQ..1kuU45apy5Yx23HAR0AzY4 0T7DMF6i9Hm2C_mcD8O_MDD4NWhPEzl3i2ddvOIeiJaT3qLIS3q4y6TerHf1Rpa9V62vCf5NuMfa F115JdgVAKEaN37_LDTh_5QgSSpezwcE_PdynM0GT7kapehBh7pYiq5RkfQIALWHaCm03sIIXnhD oCGJrgRhbRiy57RoNAhXvKnQtXyeQMWURWuYKN9mGIqqcgr8vGGmvDDHLIRvR_xBBoXvT7khIW5p rjH7_.T85f.1VsL_M6eo15tibVK4qorxPNTD5Lf9X_4EXNY4w4dXA_KfG2sdUhrwurJ8wy8_8QLk zvXFcw4IjeU4iQudpeZJcXw1es2K5XD6Eph5fKjKyprZtU.lLefx8cZ0.5CspbP_FsPT71KG_GHq gY3RHGQWzlPPVFnukSxdV0SHSkPKnyD4sXMj9vZlBMNHUg6z9Y2_p6UzoCVK478QFEpX9uypFBSz q69j3aS_4MfAEVmqClfyViiQ2jDSj5XthjcO8_9nNDuDqmkjU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4OBoAxfHY DB3N1x3SmjpVjcMD7WpJY4uecreA1JycUyVjViLhIG4Bj8ir6VIKXC.PxPiIa_Ca2hr.NvIpr8m_ xox5itagkVz4J6DuRUhGdMh_6wtRG5IULyO1qDGUazlDcTjEnG9JYYuF.snlyPFi5Kl6GGvdZbEi 08V49YJznU1A00.zbAlbIKufMrdqep42D4Z970sqHp21saXOU3iDUSLdLGCa9.G714UZWArDp8b2 tFr1M6fWbhJWq8fNaJPjCtf5u8uzVJfPsrz8gGnKFCAzUvtIaa1HjFqRgR8dvgJq.WNVmcxAhMD5 Hx8Q94hJBEdLkJtUNj5m5swa.rDxqRQD1ATPa5ZIXpyO_pDKEu2eSYidd_UkeeumRHBYilKJYnLp 2_x_3Txkbjd7srUvW1WLeKlxERFb8ltEfKBeFh6Dt7e4kdiXQRZ0jKo.1SkAE4jJ1ryPeZFfSUTd avbEJf8z42bOiGp7EdmQXLevDoyIPVyH0n0H0zyef.3W.bRXoma5TJrhIgHdiUz_JRt.WG72rtuQ K24FJxKD6cOkXlTxESN2UTG3Xw2BQBoGwz1.2.1XHo2KgmT7yKlykGVeJ9vXEgDQE100yUo61rve Iy8jeSs4hwzLSoA-- X-Sonic-MF: From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org, qemu-trivial@nongnu.org, Stefano Stabellini , Anthony Perard , Paul Durrant Subject: [PATCH] xen/pass-through: merge emulated bits correctly Date: Fri, 10 Jun 2022 15:10:57 -0400 Message-Id: X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable References: Content-Length: 2390 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=98.137.65.83; envelope-from=brchuckz@aim.com; helo=sonic313-20.consmr.mail.gq1.yahoo.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 10 Jun 2022 17:07:33 -0400 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" X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1654895560077100001 Content-Type: text/plain; charset="utf-8" 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 inverse of the emulated bits is merged with the host bits. In some cases, depending on the data in the registers and the way the registers are setup, 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 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 --- hw/xen/xen_pt_config_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index ffd915654c..bc0383f7fb 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -1966,10 +1966,10 @@ static void xen_pt_config_reg_init(XenPCIPassthroug= hState *s, if ((data & host_mask) !=3D (val & host_mask)) { uint32_t new_val; =20 - /* 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 2.36.1