From patchwork Fri Jun 10 19:10:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Zmudzinski X-Patchwork-Id: 12878346 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 1E8A1CCA47A for ; Sat, 11 Jun 2022 04:42:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.346665.572977 (Exim 4.92) (envelope-from ) id 1nzswo-0001f0-BP; Sat, 11 Jun 2022 04:42:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 346665.572977; Sat, 11 Jun 2022 04:42:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzswo-0001dq-6R; Sat, 11 Jun 2022 04:42:06 +0000 Received: by outflank-mailman (input) for mailman id 346665; Fri, 10 Jun 2022 19:11:17 +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 1nzk2O-0005Fb-Qj for xen-devel@lists.xenproject.org; Fri, 10 Jun 2022 19:11:16 +0000 Received: from sonic313-20.consmr.mail.gq1.yahoo.com (sonic313-20.consmr.mail.gq1.yahoo.com [98.137.65.83]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 174cbca7-e8f1-11ec-8901-93a377f238d6; Fri, 10 Jun 2022 21:11:13 +0200 (CEST) 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) 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: 174cbca7-e8f1-11ec-8901-93a377f238d6 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+mIw2XEQuzGI98ELB7Cyday4ifW7Q9CEUzIXlFFZDTz0NGVrKTlAb5vhYc7l1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5m5swa.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 References: 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=988333 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(XenPCIPassthroughState *s, if ((data & host_mask) != (val & host_mask)) { uint32_t new_val; - /* Mask out host (including past size). */ - new_val = val & host_mask; - /* Merge emulated ones (excluding the non-emulated ones). */ - new_val |= 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 = XEN_PT_MERGE_VALUE(val, data, host_mask) & size_mask; /* Leave intact host and emulated values past the size - even though * we do not care as we write per reg->size granularity, but for the * logging below lets have the proper value. */