From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131746; cv=none; d=zohomail.com; s=zohoarc; b=Hz1dt4wok6Lh+/rohRtSOUA3UTmuwHZwLP5qb6960jEQUhkNP15eINLCiQYB8dBJXKOnxc7NFPCa81Bh+mqNEXa0SHZabg6cCyK37+sR9xB4iAUzuXcYWzFQy0nXOPHeDQgwPRaeQehg7cbSiHOFcWqQOyBUapX/Kj0Au+y0rA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131746; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5lM3M/27cmxL429SQ6zeAkdGwYl8tz0wXYP78bVYgaU=; b=Gn8LFWwaBZKs5Q+piPvIsWjRvy4IIR2xK36pSQ5ThtkghNYF9Zs1l50CR/TBs5J4iVd8aSfH9ePzQ/7q1qfsRd0f/dSf/TjFjIMvAfiR1lzd07/rS9iz30JvaZ78oEat9HFaj9CCbpC16vu1hyd6aIh5kKWc8bb8GmzYD0LBm3o= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131746218913.7412355269942; Sun, 8 Nov 2026 01:55:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzbo-0005YK-1P; Sun, 08 Nov 2026 04:54:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbL-0005QM-VC for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:16 -0500 Received: from st-2004c-snip6-2.eps.apple.com ([2a01:b747:3001:201::20] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbJ-0005xj-3b for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:15 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 92A9B18001BD; Sun, 08 Nov 2026 09:54:08 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 3A5B318001BB; Sun, 08 Nov 2026 09:54:07 +0000 (UTC) X-ICL-RepId: 01a1ba94-5ff6-746d-bdbc-703e91b3cea2 X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQRNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGAF1UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131650; x=1825667650; bh=5lM3M/27cmxL429SQ6zeAkdGwYl8tz0wXYP78bVYgaU=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=XkxTWbQUNQ2lWNgQUBnK2hpwVIVNdRk49Sb9b8UrfEj2QXuZi5WnMlQQSzIkUqy2BSDHg+uRuYbl77ZonwddK4NPZVsM4dxNXdpVh+3bkV7JHk0g3xJUDLbmqjVD/IfeWkwvVTzue++QTDgBWr1+aSrUacVw4PRHIFKBlLa4DfSOHRxCO5V6LxJnt7+wXi129EwRHNubfg7znBW5pN6n4Vl8ARI7AWjD7zSYxeBdBWAKjGbfeY0/obsFeph9CKfAyIZ4EB/N8Cz8wA0AeDcGN6fI16Imx507S0pYBGb9OLjgseRoWxJl45LOal3f0SGiLjMiDFetn8kpHo3fBtDI+w== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier , Doug Cook Subject: [PULL 01/13] target/i386/whpx: fix VMX capability MSR values Date: Sun, 8 Nov 2026 02:53:51 -0700 Message-ID: <20261108095403.70813-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: PJ8a84S6LyPd3qynDWISoHfSonQ27acU X-Authority-Info-Out: v=2.4 cv=IaKKmGqa c=1 sm=1 tr=0 ts=6af046c1 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yMhMjlubAAAA:8 a=34rDk-nlojoYW5TMjDsA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX9kDNodiYJPyy fQ7nnPX5g5e75pT8Uo2G39dfLJOQDb1VIaeIBdCwt+0ThyHKR8Z36WyxVPnp6/6JnDCdAl64HvM uSJp1TtrMlaZyiz/bgqJQ7XkFUr2skr5g795/isRmA5G7Rx0T4GecAYcT8LuOdPjVtMpTaMNqiZ 9OR8RwTAxP+49NWIcvWYIueBM/IbmmTv8EJn8bz9R9lK6OYnGjpSeZSjE0VbHKGCU4qnxAmQSDn M3ttzRp/Ee8X1Gst3413ilnGuC1uwrapPmR8Cjz0W1yrq5GXx4FMjnJxGTk1uGJR2iAMlglkeCs ziqQRracE7FGIhAHAFMoM5nAchdAdJPCG9JZUx+G4SEf/KwP8YiBwJcu1IW0SY= X-Proofpoint-GUID: PJ8a84S6LyPd3qynDWISoHfSonQ27acU X-JNJ: AAAAAAABwe+TGvjZQaA4O3stG1JxA/ZojbFvU9DgbcpQeEiwQYkc4qF7TBVxWOw1hbRYfE H5Tvc3ICQdTyyfDFp1DPvJnealZr5A9nKKGsOLeVG0wdz42kty79Ku3GRdI4XYjO3YF/XQ 3IK/qNmTzki6H9dDjPp6iLsozjPgoUEC1qLhsU8gBNcMggUvigWhxvpZmi2hCM82hv0oiY iHSPi2tyWsTTYaMt8sCRm3oZBG4Y+Qu6foWtR+WUuKor9HJJQKW8vtea1JCxEClp5Kvr9Q AKKbrflXYeSLFJThpNP9vW14GrzI66qQ8VemguVlP8LmumdkXuSMsBMPHZ7ktVyVlvWNnK KxW9h6Q485kRKxfSRAVXcYGyY65XjfpeZ5ZVI3b588yNVojntPs4oT4/o29ci0gbbXvCwV J/aiwSRXMbQqyE1nb/UfZeokc+4EQbnTah2ywx5IeptgAmNQNau+d2zBfB+z7wVys3p/M/ HLoRrPCveLATMajVBkbiptj4i7uE0nJYYu9N/8r1QA7wzZ8HAz5OX15dOAR7sojGCHG9iZ vSEXgqPBO7yZTfF6hWSnv23lgFlfHbOUPvQ+QOfOwBEaXtmlEX9kD9GTVcY1bfE13++dMR /h3Y/v/CJbNr6HkjmD1nj9qIE8/GHa4ulwMF8f1L8IkX00l9JvAsMCRp5hmufDuTspMET+ 5egpiOO04yiogvK2iA66jPVHoKruoCLcdfEzrRorllOYJL6w+eXZyQ4ZxZF8v7aV2+jf44 WUZU3yDm1sk95BGr41wEsF9ruWzYDga6lbTUHoyiLOXMSX2Ksqs0s= 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::20; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131748890158500 Content-Type: text/plain; charset="utf-8" From: Doug Cook whpx_get_supported_msr_feature() had two bugs in how it reports the VMX control MSRs: - MSR_IA32_VMX_TRUE_PINBASED_CTLS and MSR_IA32_VMX_TRUE_PROCBASED_CTLS were queried using the non-TRUE capability codes (WHvCapabilityCodeVmxPinbasedCtls and WHvCapabilityCodeVmxProcbasedCtls). - For PROCBASED_CTLS2 and the four TRUE_* control MSRs, the raw allowed-0/allowed-1 pair was returned. The feature-word code expects only the bits that may be 1 but are not required to be 1. Apply the same transformation as kvm_arch_get_supported_msr_feature(); make_vmx_msr_value() adds the must-be-one bits back afterwards. As a result, with +vmx QEMU treated many VMX features the host does support (secondary controls, EPT, VPID, MSR bitmaps, ...) as missing, warned about each of them, and dropped them from the CPU model. The guest itself reads the VMX MSRs from the hypervisor, not from QEMU, so this did not change what the guest saw. Signed-off-by: Doug Cook Reviewed-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 113f79afb9..1386affa9c 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1452,10 +1452,10 @@ uint64_t whpx_get_supported_msr_feature(uint32_t in= dex) cap =3D WHvCapabilityCodeVmxEptVpidCap; break; case MSR_IA32_VMX_TRUE_PINBASED_CTLS: - cap =3D WHvCapabilityCodeVmxPinbasedCtls; + cap =3D WHvCapabilityCodeVmxTruePinbasedCtls; break; case MSR_IA32_VMX_TRUE_PROCBASED_CTLS: - cap =3D WHvCapabilityCodeVmxProcbasedCtls; + cap =3D WHvCapabilityCodeVmxTrueProcbasedCtls; break; case MSR_IA32_VMX_TRUE_ENTRY_CTLS: cap =3D WHvCapabilityCodeVmxTrueEntryCtls; @@ -1474,6 +1474,31 @@ uint64_t whpx_get_supported_msr_feature(uint32_t ind= ex) if (FAILED(hr)) { return 0; } + + switch (index) { + case MSR_IA32_VMX_PROCBASED_CTLS2: + case MSR_IA32_VMX_TRUE_PINBASED_CTLS: + case MSR_IA32_VMX_TRUE_PROCBASED_CTLS: + case MSR_IA32_VMX_TRUE_ENTRY_CTLS: + case MSR_IA32_VMX_TRUE_EXIT_CTLS: { + /* + * These MSRs hold the allowed-0 settings in the low half and = the + * allowed-1 settings in the high half. QEMU's feature words = want + * only the bits that can be one but do not have to be one, so + * apply the same transformation as + * kvm_arch_get_supported_msr_feature(); make_vmx_msr_value() + * restores the must-be-one bits later. + */ + uint32_t must_be_one =3D (uint32_t)val; + uint32_t can_be_one =3D (uint32_t)(val >> 32); + + val =3D can_be_one & ~must_be_one; + break; + } + default: + break; + } + return val; } return 0; --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131702; cv=none; d=zohomail.com; s=zohoarc; b=QrLgG48wG/3LKMBz3yvvgKBBm4hrIPHgdTmujTv8pNCR8MEoR0pFCjOiPX5FSOBVc4C/gm+YR5wWFKXGTBKRJkSqbhDpQJJDmXkRo8TzcOLL2gTAiU0kQEHZRWeecauOW1FhuOibVZsBHG0BiN6TzooG33GX6wduhvAqEqeB3cQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131702; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=x6QpE31YHSYm3IN5HGzUQG5BULloTc4Z+l5HgHvxa6Y=; b=YkpuVVOogzqccvx+fJnwixgbOMrBYH5tJEd3FFU/1xm+ZR4Q87RdaKXe/40ykDbEPnS9nEJOmw84Sj5kw9BIr5JQfynRIbgV/yRmf/qnVNTqBSsVfu7fTYBRFfPbcxpnAh2c58+qloLeT0YzjNTjB02JRWr25VOW/yeWB/IRuqw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131701810809.1207666962531; Sun, 8 Nov 2026 01:55:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzbV-0005U4-Ua; Sun, 08 Nov 2026 04:54:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbM-0005QV-90 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:16 -0500 Received: from st-2004d-snip6-4.eps.apple.com ([2a01:b747:3001:201::23] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbJ-0005y8-B3 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:16 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id A876018000ED; Sun, 08 Nov 2026 09:54:09 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 1993018000D6; Sun, 08 Nov 2026 09:54:08 +0000 (UTC) X-ICL-RepId: 01a1ba94-6417-7fef-ad09-2730305d381a X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQRNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGAV1UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131652; x=1825667652; bh=x6QpE31YHSYm3IN5HGzUQG5BULloTc4Z+l5HgHvxa6Y=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=q4f8xgExoiOwvGMxhedSd1np6okaeThoWuWR3CSQJvegAVXZW7IDM2carSB8kqUDEsRV8dQ9smqMvNonNO9/Yf8l+nccTHiFvssEiZhtw0TxgXBW0fxek1qX+HcrQHYRvssX6RrApJm/qBlp2StR8Y8WeSytr06ouerjmkWwVvG/TODOVDxuv+pzPo48XXttfTuKhHm1KS6pBCzyL1R0mvVizIeJbQwjRMyUDpn+7OmVvgOpXo+HbjBWRri+rns+bQmD8/xabzjeU8/T8LMBzuPSdt3y0mbN7TJzxCiIIOTjsa4YChhUtUDfE328+iqbwlueU1zjOAB3f864lE+PIA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier , "Doug Cook (WINDOWS)" Subject: [PULL 02/13] target/i386/whpx: whpx_get_xsave_state error handling Date: Sun, 8 Nov 2026 02:53:52 -0700 Message-ID: <20261108095403.70813-3-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: BEB1jVwQB54CnLYgCGCqmco6zCmWPaub X-Authority-Info-Out: v=2.4 cv=VLLQXtPX c=1 sm=1 tr=0 ts=6af046c2 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yMhMjlubAAAA:8 a=CyeGX34NJn-RfCE8euUA:9 X-Proofpoint-ORIG-GUID: BEB1jVwQB54CnLYgCGCqmco6zCmWPaub X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX+qqowpRm8AeO s8wq9Kawme0METtJ8gF+60QP8lZiTBAUbBsrvsDYiWJUiUyN3b8dAQcLmYgOBKC70v9b56GeQgz c29BYOcwdvUDhBVc42GOvediglQ5eqvSgjZ+KXnVGHwWqmK5nKI2pfyoJ2GMhf4EsmuM2odgIXJ G/drqvVl0/RCoEGRembA8zmxbyFaqQpKea6I0WmSKApvJF1sr7rBKqOQ7XRB6r3PP/5xZ8lW5l1 4IoWsW3ASIR56sdGtnZ+4UNgvW/mKXa1+hlGC9uQEsaLvWy/E5zWJ7iSV2t3a/mDvh34qmYAzeg QVcMedGbHDFrxBjtznznNpcMcjnhaDL4mTc0oGbKsi2pu3MI0daZQ4OhWv6RZ8= X-JNJ: AAAAAAABpC7efIPx2JzibChvC2xRhc2c1mLsqDhV0O4wO2YglJGfpJxNItJVkuESoxGJAd rzmKlTwVP3w7qqpu4FYNLz5x94kk9mbG9V8yRMg4eI3bTwb9AaWMSpu50XK3yTxGpT0Emp 66vFfmto/Ph3vviVGr6vvT1HLFj55Wy95BEXHAn9PJ+vLT9y/WXRj5Zg5yZ18ffc4eOQz/ n8wLVb8FC4Uk0p9Qbane3ruymlf4iYZQBmuqHJlg7W3NzzBrWGGSAl+8xPi6Re545U/LbC Yo8My/pcqT/RIaOLSZHvj7lJS5k+WOa1C5MYCNoeOwyjam53j8YdqzgPC8isXNIHh7eoAy knD6DXhD+UmmQ+fS0xdUcpfrxMAW6x6BrovW6HMS6Zj250hJGTaTf0L+BJIzfRmwY/xHSQ 2o+Cki1r0gKxnoOvbNWF+BkOVE4HtmgUVdRbWYKdo4yimKSKc7t6kfj+l2s2U1X6NMBaKl K9Guk6lT/IovLBB0ZyVk6i9fmc3sUvI8Ao+FNU5R491y0d4RZaDh/h8D6w+Jwuh09/8WpT ZNHL20qTbs+N3+Hmvb2vd6t6OROMyd4y0va6JwyWmiHPFNbDI4fW9j5Br1VS9r6NNOzMQl dztQMTsokj0o1X17Gfss2owQczVJXfOGutxAFNRwu2hoEhWEEEJXSHN+UUyjCQGUuarzZv 9Fiyp6FZ1zHaYU0vKKj3uZoHSghcGckigvPY/Sn031Gzc4aN7CkMeoEwOiWY3+m3yh1lbo bqeCSjU28qUVBwOI2xw4Xu4p/JnRFZ7hN9SEyTtSOJcdD9Gkg7xBgDllk= 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::23; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131707134158500 Content-Type: text/plain; charset="utf-8" From: "Doug Cook (WINDOWS)" Several problems with error handling in whpx_get_xsave_state: - Does not handle WHV_E_INSUFFICIENT_BUFFER, which occurs frequently in practice for XSAVE state. - Does not free xsavec_buf when an error occurs. - Error message and return code use errno where they should use hr. Fixes: cfaa3b6c9597 ("whpx: xsave support") Signed-off-by: Doug Cook Reviewed-by: Mohamed Mediouni --- include/system/whpx-internal.h | 5 ++- target/i386/whpx/whpx-all.c | 73 +++++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 21 deletions(-) diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index c295c5a529..b15f3d8faf 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -58,8 +58,9 @@ void whpx_apic_get(APICCommonState *s); =20 #define WHV_E_UNKNOWN_CAPABILITY 0x80370300L =20 -/* This should eventually come from the Windows SDK */ -#define WHV_E_UNKNOWN_PROPERTY 0x80370302 +/* These should eventually come from the Windows SDK */ +#define WHV_E_INSUFFICIENT_BUFFER 0x80370301L +#define WHV_E_UNKNOWN_PROPERTY 0x80370302L =20 #define LIST_WINHVPLATFORM_FUNCTIONS(X) \ X(HRESULT, WHvGetCapability, (WHV_CAPABILITY_CODE CapabilityCode, VOID* = CapabilityBuffer, UINT32 CapabilityBufferSizeInBytes, UINT32* WrittenSizeIn= Bytes)) \ diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 1386affa9c..68272c5657 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -442,8 +442,8 @@ static int whpx_set_xsave_state(const CPUState *cpu) =20 qemu_vfree(xsavec_buf); if (FAILED(hr)) { - error_report("WHPX: Failed to get virtual processor context, hr=3D= %08lx", - hr); + error_report("WHPX: Failed to set xsave state, hr=3D%08lx", hr); + return -EIO; } =20 return 0; @@ -809,9 +809,28 @@ static void whpx_get_legacy_fp_registers(CPUState *cpu= , WHPXStateLevel level) idx +=3D 1; } =20 -static int whpx_get_xsave_state(CPUState *cpu) +static HRESULT whpx_get_xsave_state_buffer(const CPUState *cpu, void *buf, + size_t buf_len, + UINT32 *bytes_written) { struct whpx_state *whpx =3D &whpx_global; + + if (!whpx_is_legacy_os()) { + return whp_dispatch.WHvGetVirtualProcessorState( + whpx->partition, cpu->cpu_index, + WHvVirtualProcessorStateTypeXsaveState, + buf, + buf_len, bytes_written); + } else { + return whp_dispatch.WHvGetVirtualProcessorXsaveState( + whpx->partition, cpu->cpu_index, + buf, + buf_len, bytes_written); + } +} + +static int whpx_get_xsave_state(CPUState *cpu) +{ X86CPU *x86cpu =3D X86_CPU(cpu); CPUX86State *env =3D &x86cpu->env; int ret; @@ -824,27 +843,43 @@ static int whpx_get_xsave_state(CPUState *cpu) xsavec_buf =3D qemu_memalign(page, xsavec_buf_len); memset(xsavec_buf, 0, xsavec_buf_len); =20 - if (!whpx_is_legacy_os()) { - hr =3D whp_dispatch.WHvGetVirtualProcessorState( - whpx->partition, cpu->cpu_index, - WHvVirtualProcessorStateTypeXsaveState, - xsavec_buf, - xsavec_buf_len, &bytes_written); - } else { - hr =3D whp_dispatch.WHvGetVirtualProcessorXsaveState( - whpx->partition, cpu->cpu_index, - xsavec_buf, - xsavec_buf_len, &bytes_written); + bytes_written =3D 0; + hr =3D whpx_get_xsave_state_buffer(cpu, xsavec_buf, xsavec_buf_len, + &bytes_written); + + /* + * whpx_get_xsave_max_len() returns the size of user state components + * enabled in XCR0. The hypervisor returns an XSAVES image, which also + * contains the supervisor state, so the whpx_get_xsave_max_len() size + * may be too small. + */ + if (hr =3D=3D WHV_E_INSUFFICIENT_BUFFER && bytes_written > xsavec_buf_= len) { + qemu_vfree(xsavec_buf); + xsavec_buf_len =3D bytes_written; + xsavec_buf =3D qemu_memalign(page, xsavec_buf_len); + memset(xsavec_buf, 0, xsavec_buf_len); + + bytes_written =3D 0; + hr =3D whpx_get_xsave_state_buffer(cpu, xsavec_buf, xsavec_buf_len, + &bytes_written); } - if (FAILED(hr) || bytes_written =3D=3D 0) { - error_report("failed to get xsave state: %s", strerror(errno)); - return -errno; + + if (FAILED(hr)) { + error_report("WHPX: Failed to get xsave state, hr=3D%08lx", hr); + qemu_vfree(xsavec_buf); + return -EIO; + } + + if (bytes_written =3D=3D 0) { + error_report("WHPX: Failed to get xsave state, no data returned"); + qemu_vfree(xsavec_buf); + return -EIO; } =20 - ret =3D decompact_xsave_area(xsavec_buf, xsavec_buf_len, env); + ret =3D decompact_xsave_area(xsavec_buf, bytes_written, env); qemu_vfree(xsavec_buf); if (ret < 0) { - error_report("failed to decompact xsave area"); + error_report("WHPX: Failed to decompact xsave area"); return ret; } x86_cpu_xrstor_all_areas(x86cpu, env->xsave_buf, env->xsave_buf_len); --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131706; cv=none; d=zohomail.com; s=zohoarc; b=WzI6rtBkzcNaDDgfVNb8fSx9QVbQ5X0HVopq1/fPwX+XQy5+pHZaePWB0XuKGHQmmgiLPD13ZSJ5g6ysBORhxzL9FEbVsf/4A+p7W6qxPOffU//p6f2CS+puGbAXV+kx+98VtsNoN7AMh9Tre11qvu1K9tVqtjhMpE5+48DcEa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131706; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BMfLaruRwjS2EuVB1qFM1OkXquvXAo2QdP40DhTsI1I=; b=F3FKbz1EuzCsD1Dm7NUmZ3rj86haTQAa0tmKpok+cCov5srWf3zrML6oQKItcQhplaiz6x8bxHqpvhC19N1CXIG58IiRM5KLMrPUtnnMiUkfHw8kYjAfff8Nvmu62aig35Vl3RlkjRXQ2I2IX3jlVLfBhwEGeMzAI7zjbq9uh2Y= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131706113550.3839528699904; Sun, 8 Nov 2026 01:55:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzbk-0005Vo-Bv; Sun, 08 Nov 2026 04:54:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbN-0005R0-7Z for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:17 -0500 Received: from st-2004b-snip6-11.eps.apple.com ([2a01:b747:3001:201::15] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbJ-0005yK-Sh for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:16 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 92A5818001AE; Sun, 08 Nov 2026 09:54:10 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id E8A491800199; Sun, 08 Nov 2026 09:54:08 +0000 (UTC) X-ICL-RepId: 01a1ba94-67ae-73b2-8ad6-cec86d5cdb9a X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQVNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGBl1UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131653; x=1825667653; bh=BMfLaruRwjS2EuVB1qFM1OkXquvXAo2QdP40DhTsI1I=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=bcSFPWf29pkcpS0HSNNMXUDeYgjsJBJ5j1ytI/z0JbLQSszD6Ua2ft6+aWC1SdeyHaTXMGu5niSqDvxOd0iMU5atD1o8flb3rSp0XOyAUslA8DEvixLNWndBgWxMZAbqBSIXVyOKh4gh9jVNaXtcl+mYrf5EQtsXHlXOQW5duBm7tAf5ryCIRA8sHvALKe9Mf9hIBd5TF0paoALliE6yqXEb6FBG66pavDpcNUyxvabJJ8Q8UCKxKjqV+JpV6iroxMfqqvsPJTnTWApqOrU1AJsLEDoYX0VTtjO7WUHhe0Mkq+QPzPC5UYU+ZY0ISUwKObbn6ItuiT4sENgd80KtFw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier Subject: [PULL 03/13] whpx: i386: get APIC state before VM save Date: Sun, 8 Nov 2026 02:53:53 -0700 Message-ID: <20261108095403.70813-4-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=D8FK6/Rj c=1 sm=1 tr=0 ts=6af046c3 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=O2XxGrO5I-fc2znLRzsA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX5IUkjYqJKxGc TpWRNDh+yuGYmpmaE/7AAmA/qP/Hrj/O7ukkFqUr9ZyPzSaArsnADu+5LXzh2aw7ZG1CK5bEN7y Zt8CAjGhs0Vbcz0otNrehByfyuu1AyS7Pw+er23Wi0IIQxrtdIudHUko5Mb2cTgXGvbtHEZotBU fvy/YKHUSoW+yuDqfgv7/BPw1+tcWkSxSNH2MtzGYUAwFD6soCC0kOqhs64cmgQghx4ptMckpuv OUJaoZdXkJ1EIiFJaFn2aIUwHmMw+lEvydEMh1z/LNnf9f45NQK4mjDS34BJ9d1TcMWc1XeG5Dl a9n0ltPs+24XVrbKE8l/FTRQ58YmyKOyUFF1nPEgvS+En05EpPPTg5A5ojpP2g= X-Proofpoint-GUID: jtxZcbJkldvQ3eRYiEIwD1OYjMPURS0t X-Proofpoint-ORIG-GUID: jtxZcbJkldvQ3eRYiEIwD1OYjMPURS0t X-JNJ: AAAAAAAB6vjwAEXKspjj3P89M+YxYAtzjHCgN7m+92LoPHF3QhGEMOZy1KXR5+B/fEB3pe /mKhsPmW1epVCMLJXYUDCEIeWjutkzu0b7fYT6Dum8bV4kodfovrPBkcPG9jqu9Ojn3XuY sLuvYbS1HWoURwfes5HK31V6i8XXuUCt7Zy+YMBNtT4hZXRL94eHj3Iw91g0Qn6yh+bic1 Mqea22UUHVTQ3LOoNkjSrxUlW5KYPxa2BrqPA84F+CuCFb+bcdRkfoPK3aufbDGdNLdiXD JQIBN/eiD47RZ5UNhPXGT2cCUEhageVYve/WZ+O9pRYfoVpZHRJ6ZnXUQKqkxauKa3RKzW nqiMLVT9sfmb4kxSJ6lWbEjiF5vUyDJyHS1GRznBHuG0hl0m3R9snPG//c+v526OBNx6ye DCNlncSe03FkCaO2Nfz0jsf8gzYD7c/orSLln2Z/Nq/j1QNik69+LH3kjFaV5+l19cuwP3 d7ByvBTBgN0gBjd5P0Cz1AwlEjbgY1x7h8wjd9CNJV/MqV7bEqg2oYPqWN2/9p2Y++8Ke6 jfEOaujCNSIGWIocC9ZGCzm7ZeBSFIKIl48r/nR4lEnO9BQcQa+IKYURRhTNTTfiK0lVoQ 55WBSfffMz0saoZjIyDSX3aUfaR8ARh9hW1rWSb9N42ZU8DMWwpaF/lIICUOKSipMkUZsx xBSuI9RRH6Bt1y0c9MtX7eMfQ2yxchD4/w0wC1XuPIvxUbkwlNA648TaRGVnJJ8ZxU2sbj EdlV3SDo9mRtRh+xz483OAAIM7A4KzmNKqLzo6K1iX4FJ/3liqv2w= 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::15; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131710267158500 Content-Type: text/plain; charset="utf-8" Prerequisite for VM save/restore. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-apic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c index cc272f82a5..efdedbcd77 100644 --- a/target/i386/whpx/whpx-apic.c +++ b/target/i386/whpx/whpx-apic.c @@ -242,6 +242,11 @@ void whpx_apic_get(APICCommonState *s) whpx_get_apic_state(s, &kapic); } =20 +static void whpx_apic_pre_save(APICCommonState *s) +{ + whpx_apic_get(s); +} + static void whpx_apic_post_load(APICCommonState *s) { run_on_cpu(CPU(s->cpu), whpx_apic_put, RUN_ON_CPU_HOST_PTR(s)); @@ -338,6 +343,7 @@ static void whpx_apic_class_init(ObjectClass *klass, co= nst void *data) k->set_base =3D apic_set_base; k->set_tpr =3D whpx_apic_set_tpr; k->get_tpr =3D whpx_apic_get_tpr; + k->pre_save =3D whpx_apic_pre_save; k->post_load =3D whpx_apic_post_load; k->vapic_base_update =3D whpx_apic_vapic_base_update; k->external_nmi =3D whpx_apic_external_nmi; --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131707; cv=none; d=zohomail.com; s=zohoarc; b=NFSDkohqllbaZovGTGQhRgHzVQejZIBcu+F10Sl7ZjRerWJJX7Uo4WL0MnkYOgKaB1FjdwiT857KR7Jwsxk6ynNoAwE4PgyFzq9DXVAdVVM86WGNo1M+4BkqTtrOFzsgKZGLkysvOXdlzGkNbQ+L4wQv6JtIQzo5iPHwzr70m/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131707; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4MtoiGWVHD1ql7ktrdOMb3tf+OVOyyTmcQKxYtuN+0U=; b=U7IzbtRvlnqQD51mZHoC/E7x4HSCQyzFxujNfRvgfqgT/iEhY7XDGwoNka5RHEaK/AVnG4s6rVEEUgJiUAqBTYGL/feoYbuXFYbxYixeFXKdJEc9370dGu7U0IwXeY+n96EM+UQ9TrtcT0pVqyd+Hggg2rr9XE5y4zuWambLHYQ= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179413170695247.73169893184445; Sun, 8 Nov 2026 01:55:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzbO-0005Rf-9O; Sun, 08 Nov 2026 04:54:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbL-0005QJ-OL for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:15 -0500 Received: from st-2004d-snip6-1.eps.apple.com ([2a01:b747:3001:201::22] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbJ-0005y5-3k for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:15 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 05B2518001B0; Sun, 08 Nov 2026 09:54:10 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id AF98718001AB; Sun, 08 Nov 2026 09:54:09 +0000 (UTC) X-ICL-RepId: 01a1ba94-6968-7a61-8ffe-543f078cc272 X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQVNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGB11UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131652; x=1825667652; bh=4MtoiGWVHD1ql7ktrdOMb3tf+OVOyyTmcQKxYtuN+0U=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=C42BktnBF1H4yOGKcBlLQ1rjqNDg3cFVriUPF5W2fXoYkZBEGN2liSFZLrHM1USsXqDAco8/1Z5bcQ//8oEePhKOVc32QBrjLpi69YRTLwrST4yuMLe97P5drvDFoNDXORc3mB7RYQ3gtV3Wny80KCYhrovhkM54WiBD91oOW2+bw7g0cvsSUczfdIfvt/Lg/M5jszNqdJW56O7ABVXzHBaH+GASa5iXglz6r1Kjjyqdg+a+1fma6CqXGtUniJeaY9BmCIuqgBMBRDh3mBKicSUH3IDYaabhVp0o6FJn/n8Nda0blzBcNxG12daLOf9Yj6Abb7MsnOxLldWDmbF7Cw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier Subject: [PULL 04/13] whpx: i386: fix TPR encodings for local APIC Date: Sun, 8 Nov 2026 02:53:54 -0700 Message-ID: <20261108095403.70813-5-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: x0eHnRvj53dfMqTLR-U6etD5SUVSEiuM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfXykFQs0SKfIYN 0BaYwAuDM2KXxilGTFjfsLooJ5Tp7y5L+L93q2uQzCVZEBlB5wCtGMvA6aIS+W9RxflqS37JkqD lASVlfbtJMBVf6QMPkvSD28BOCNDSJJN0hK93DpxTHY18hKDJX4hxf82lH7Rl/ZudT8wN9HblMN JDVx2F/XtGQFcfoROHiVKu2oOdlzkjM7sRaFdfHJglnlPc88lXaryfCpL5DeSvej/GW6/ttm26m 3sj+mta0TVBZbctTdhhBNjRU5te0+CYOHI5qUoZZZ+OBIWczzXm1U/ce7H6NMiWOqtsblno82+r j/eYOnYjOf4S5sQgMBskOXMDeUDkkXqOk0l1Ry2Tj75Seyye3ZTBKtpqIL7d2Q= X-Authority-Info-Out: v=2.4 cv=Kd3fcAYD c=1 sm=1 tr=0 ts=6af046c3 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=YYz-tg3MKeN3tcD12NcA:9 X-Proofpoint-ORIG-GUID: x0eHnRvj53dfMqTLR-U6etD5SUVSEiuM X-JNJ: AAAAAAAB+KctSMk3TkWdEY382X/1hfoBBLn5F8X05tuNB9UeSRYjsTpdMISiwyjrdDaWyO 3NO+RuaCUKQfYZlfdo2JJXeeUDDQ5+VTGhIE413Xwr+D9+OpOM0HRe/iP67VeWtYHu3LEk fIpnErpnmrU8mOOYsvGvkUzgL0ibOxT3jh9/VBxZuHOVfcCau5g5kh5AuyTbYhzZ58IG8H p7v4V22CnQUcgdpgMcbITULntI9e+/1YRroqILKY2x5h7o8xEA20lZxMxkGEM02mH0xftO 4yda1GlgNc3rZiCjCwpCA6F9ytVEewRNdpqku2yXj5YuVX/z3yfAoOb6TXyADTkF2tgX3K YGtd7rMNcGzU0ZzKeovQW0cdvVssefGCnEvBowyIew4sFZKyYf96ExTOo+pbJYKKjiDY2J 1w20oJpgpJmU9ZwXWyy3nzOygj2NVpQpVJ9FjftLYoQXddqkqp1KolgHfbFtU2HRd4zQZe x+YeFSxGuYl4BmkUOXaguaEF9W8dX1aWlEcANOSDz5+VJTi24HFe2LGxRC5lKKTQEiYbXQ FjRiBYjsHTs0QfcWAwBfozUTFVGb9PoltBZsiVtSkgLodXEWbECapwBNct9uB9gqe25n9r IzRSZA5jD+5hT0vIWKjrMjqgJED9e65uE5SfTfISlv84HYzXMibee0LH3Mf2EUc11U3gOM BynIxfV4s6liDA0wYelDeM/DXZHhbLYvAZnLHa47RPARMhPXgx6e6RuHCVPDMVCn+TDie3 Aqe41C9za9+K2McxSBblyYsp6tH1JL9YXbLpDJqNp6usbzs2ueSWgJnkDIpeF7v4s= 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::22; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131708240158500 Content-Type: text/plain; charset="utf-8" Convert between the TPR and the APIC priority encodings. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-apic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c index efdedbcd77..2d83291fae 100644 --- a/target/i386/whpx/whpx-apic.c +++ b/target/i386/whpx/whpx-apic.c @@ -184,12 +184,12 @@ static void whpx_put_apic_base(CPUState *cpu, uint64_= t val) =20 static void whpx_apic_set_tpr(APICCommonState *s, uint8_t val) { - s->tpr =3D val; + s->tpr =3D (val & APIC_PR_SUB_CLASS) << APIC_PR_CLASS_SHIFT; } =20 static uint8_t whpx_apic_get_tpr(APICCommonState *s) { - return s->tpr; + return s->tpr >> APIC_PR_CLASS_SHIFT; } =20 static void whpx_apic_vapic_base_update(APICCommonState *s) --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131816; cv=none; d=zohomail.com; s=zohoarc; b=Mkoe/O6ndNnR4GGha4gCsFBzbvNIf4msrev/Re15ahJ3wZridlmG0oB51fEdD167ArX9Moyi7+RsWBu1X8fKWFREvnsiSPgzJL/CVaWk2T6efHbJknt9cWgLdpbf6SJ7PKlMV1yxT5u2tiwlotM45YABhuLAl+dXmFDUGVAJBkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131816; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nVK8vDM8XzoQ7gU4FL1Cwxgq28hF7I8+bUQSMNiuXqA=; b=kvW4DR9q59fUz2L27NIvbrkeybChvwTK96ls1NVe12lNNQqe9YZmhzouNaFGBnOGOJgdl+ZaT4B1dsZfIVmi2Sr4+s6GKE0CruntGWBgoslBjQWvHuBaMwqWfnw3VWtVfjH55903I04ktR1BroaBHnU2oIDsWvlb4WQrZnIhZNE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131816254287.9323268779302; Sun, 8 Nov 2026 01:56:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzcx-0006Gz-Sj; Sun, 08 Nov 2026 04:55:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbO-0005Ry-Fr for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:18 -0500 Received: from st-2004l-snip6-5.eps.apple.com ([2a01:b747:3001:201::74] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbM-0005yx-5I for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:18 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id BFA91180009C; Sun, 08 Nov 2026 09:54:11 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 821A818000CF; Sun, 08 Nov 2026 09:54:10 +0000 (UTC) X-ICL-RepId: 01a1ba94-6c70-7c28-8ee5-b9e2ef524329 X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQVNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGBF1UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131653; x=1825667653; bh=nVK8vDM8XzoQ7gU4FL1Cwxgq28hF7I8+bUQSMNiuXqA=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=Gk8jgT7NY2hDh/YqaFvVFvuteeuIl/guR9DPfVXm/RbC2zjl7VbRx8u9G7AG9LOL1ATFm5b8gpxq8zbXdP2dy0DKNCnFF8cJhRxf0/YUkdZ0R/0bSKWkWVFSF/ufSNopVy7EqELsgdOwijNJNw9W17gKUaCsITAqlwf52MCVZsvcWzlU4PTT7ZEbqm140yxDKNlpZtgLLyXEx7TqWTEc2wqphV/8092OABhHu971xvCxp+mSWFd3Sn+RkS6WauCZNIrNtvq7T9rMppX0gjyswMfHW2A3wwt+BN4o/USiFRirbdDF+r+P0PVvIhbNQI6g2cSsoD54tMykpDVG0HAJ/A== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier Subject: [PULL 05/13] whpx: i386: save/restore xss Date: Sun, 8 Nov 2026 02:53:55 -0700 Message-ID: <20261108095403.70813-6-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 78yMvUOEDbqg2SFD_ZO1f96EggqiAN-b X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfXyIMts92ULh5t X6QFGdLYFNh2M71Qp6HUrfWxcrSTtBNs5xDeynvzuhzrU9HKSHZRmVamrnDSlA4mXb6RJycEJeT z0ykqMugzCNnMJeYBveyyqgvOORO68NtUYg67WYnPX7kJaLZ4aZqzvDaXDBha/ulXyuEswRiRF8 yTztnYYXReuw5PtOxjQZvF94JP/gZvk3nEHQ4FzZqDy/5Q4NCCUBRwzujelM0+7QQ0vuMF+hCpG gItNibGkOHSYxD602xwHiohj8+1+lVJn9SDav6gWkQfAvdOPCFbzoSTxO4hG2SIy2P0/FqltNRs /3ffx4PLv+zZtDbvKhX3I+0GhNQLksNu56CqL7T9b6i113nkf9PP2Wq5SVpYes= X-Authority-Info-Out: v=2.4 cv=Kd3fcAYD c=1 sm=1 tr=0 ts=6af046c4 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=vvjR5Bv0Qg6bciTORDEA:9 X-Proofpoint-ORIG-GUID: 78yMvUOEDbqg2SFD_ZO1f96EggqiAN-b X-JNJ: AAAAAAABqoQI8lw3BYiolSmSeGqUaPUvkI/9B3NQWHocsPy9BoYI1tyHy4knRwEJ0aRJOK naItuVcrs22Z6t/+wqQhzArBSN8rjMhHKIHlgNLFAfqbZ4z8YxcEqJLVJ+cbbivnq4l8Gs etvR3vl9Udi0Tvubb33Gu1x3oR3UC8INvlOORdcuqFYVJsaHN3NcfFuW3UpVdz/M+7PpFe b/2OSgZcWaWxXpBMDSY38HhjtkFHgwsy2A590gtRkeGrievrGmsBYRURq3Ptc4xNRvFhPE bbOk/VQ72tIgSqpNYdE+fArGTrUMAl8EkRiJX32v5XsUMHNnBaARTBln642kuIqE+/FdW/ namMDyaGiB+ItRscTT6VTTZbf+pSSxZS1oZyl336jppGppcVqhXk15kOf7oAGcTVRZObLC /UiIMCW4f/1Z8uLVO4glJKHKGDznzynMr2W7ai5D8uII3Odlr9k9Iarzi/7LkxhFtsbJ5n Wva4lCEdLyeG7JuST0NsuQHMxH6yRYQ7qDx6XRQeSOnNLkUICou5nnN6v7gViCf++VPMkD VMc/wIOVt1SMwFgCKierd9RoRrTutHrc52KmAt3446oVGWK+ZI5z7wR3lilSn7nZmnKpru qdLpMzDBNiefqHRPX9X6Z7sPZNTWB6pkogaVmKB2mHOb3Al2gZcwvjWgCr2QwyvGCz0lMP RmyLIPUap7GxmMVoT36Msc7xJobEVYq6WcNnzgaLwc+4maMLoH3t4UOVdecGl9dbBJj4b6 SnG6V7mwQw5MnhHUJocpsyiVymOC0DSLYQnLet2Wj+mw== 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::74; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131817859158500 Content-Type: text/plain; charset="utf-8" More work on VM save/restore Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 68272c5657..408a1667e0 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -346,6 +346,8 @@ static void whpx_set_xcrs(CPUState *cpu) struct whpx_state *whpx =3D &whpx_global; WHV_REGISTER_VALUE xcr0; WHV_REGISTER_NAME xcr0_name =3D WHvX64RegisterXCr0; + WHV_REGISTER_VALUE xss; + WHV_REGISTER_NAME xss_name =3D WHvX64RegisterXss; =20 if (!whpx_has_xsave()) { return; @@ -358,6 +360,17 @@ static void whpx_set_xcrs(CPUState *cpu) if (FAILED(hr)) { error_report("WHPX: Failed to set register xcr0, hr=3D%08lx", hr); } + + if (!whpx_has_xsaves()) { + return; + } + + xss.Reg64 =3D cpu_env(cpu)->xss; + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( + whpx->partition, cpu->cpu_index, &xss_name, 1, &xss); + if (FAILED(hr)) { + error_report("WHPX: Failed to set register xss, hr=3D%08lx", hr); + } } =20 static int whpx_set_tsc(CPUState *cpu) @@ -691,6 +704,8 @@ static void whpx_get_xcrs(CPUState *cpu) struct whpx_state *whpx =3D &whpx_global; WHV_REGISTER_VALUE xcr0; WHV_REGISTER_NAME xcr0_name =3D WHvX64RegisterXCr0; + WHV_REGISTER_VALUE xss; + WHV_REGISTER_NAME xss_name =3D WHvX64RegisterXss; =20 if (!whpx_has_xsave()) { return; @@ -705,6 +720,19 @@ static void whpx_get_xcrs(CPUState *cpu) } =20 cpu_env(cpu)->xcr0 =3D xcr0.Reg64; + + if (!whpx_has_xsaves()) { + return; + } + + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters( + whpx->partition, cpu->cpu_index, &xss_name, 1, &xss); + if (FAILED(hr)) { + error_report("WHPX: Failed to get register xss, hr=3D%08lx", hr); + return; + } + + cpu_env(cpu)->xss =3D xss.Reg64; } =20 static void whpx_get_registers_for_vmexit(CPUState *cpu, WHPXStateLevel le= vel) --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131811; cv=none; d=zohomail.com; s=zohoarc; b=gaEQ5p37ozooWVnJF67czWS/aRPHR6SD4jkV1T57JDruMNDWkr8BLjdrcdSw74S8skF1qXAfPcNzG2H/h5lWSmMY0ShehfUUpfqRSHu6fTaTe2IdqIyew9E/mevKN0req8J+/k2sLVJ6DW+XFs4EgkdPPdYozajFKiequeFbicA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131811; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dSrwibXLl61KPeY0mbb9Kw6Bj1BM0S+HBdlSgsEMB5s=; b=BwHKMUc/aDhufm2lLTSYvTMF5sWaQu3mVsxZbaF4aLMUJeBflMGM6bfd+K5Oae5wwCCtNavSZN1Icw5u0AScN6xubitQhEKo1chwtBFatFDd3MH0VTHxrs3ikQAXEwFeHxnfbNUSVdHmBCuoBtoHbJzAeREPhXSmlx0GSFr5cx4= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131810564468.281020249688; Sun, 8 Nov 2026 01:56:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzd1-0006X5-Ks; Sun, 08 Nov 2026 04:55:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbO-0005Rv-B8 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:18 -0500 Received: from st-2004k-snip6-11.eps.apple.com ([2a01:b747:3001:201::6f] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbM-0005yw-55 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:18 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 802E518000BC; Sun, 08 Nov 2026 09:54:12 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 480E418001B2; Sun, 08 Nov 2026 09:54:11 +0000 (UTC) X-ICL-RepId: 01a1ba94-6f55-78d7-ae20-4d6392faf1b2 X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQVNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGBV1UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131653; x=1825667653; bh=dSrwibXLl61KPeY0mbb9Kw6Bj1BM0S+HBdlSgsEMB5s=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=ksFn/+9ztwWApahzihlqqitxs34IkzR5cTFGoNzsMre8BvnnYJhp20lagxU5gOestG883hJZpA/HVgL9oOauwox5CqgkB1/hz+uzxgTGzkmvO+0nn1QjL+DTP+rMe/AvFouHyxIXnNGT0CGDJ9sbtpCIUtMZSdmO12lV/KNFDKN3bE3Oha+5je+Ezpx8vHU/5XEmfpo4s8W55ZtA6Iu86QtfzGYfaacT92q+4SlBSVraBEK2qcVv9PO+3yulVwaXARPERJD+Kf2q89AkoXqpVqJwUk8pxZk7cLAdisV6/1lI89Hcy9aVGKHNdg9PF/lXBTa8A2N2mcg5SHuIUSR5Hg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier Subject: [PULL 06/13] whpx: i386: make nested virtualisation init failure non-fatal Date: Sun, 8 Nov 2026 02:53:56 -0700 Message-ID: <20261108095403.70813-7-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: dx9k0bRejrq_TBDawj1GdvmSTfySXjGw X-Proofpoint-ORIG-GUID: dx9k0bRejrq_TBDawj1GdvmSTfySXjGw X-Authority-Info-Out: v=2.4 cv=c8CmgB9l c=1 sm=1 tr=0 ts=6af046c5 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=p5XUOwc6s_shZ6Vv324A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX1leme134/Xgr lBfDE5NjHkPt/BEXQMkYoPgTv9mVpxw5+hMqQz5SsqNglVUcc3rNR960YGZpynRtr8k3wYk5PJF +BrUSmQPlt6XuflcCpToWQBEt7XUTV7zDpz/Ia1yucRqNIVCV1sbwW6qZowUdPq5587trxjL3A8 nwxfPJazNzGI/LubS5y1JXRBA414RGpm1Nz/biTsB8JxvsoeD4ADf3/fTEJJOP8TN85P76MS6w1 3IO+qzul9BfbuptF+EMz10uH9Nts8iXH2oL1m6kS9q/BoDNSFqlYMruRFOy6q6zBNmuaEh8U/2u 8eVrvbjna0PaMjpVxjBuNQuHTuwbBdC0FQ0EV5Z0e/1C+bQJFxZupOMwhJyLb8= X-JNJ: AAAAAAAB0L7r4DkCP5ezPWfvXYgQw9nEUcLGXN78M2av6qFs0NPKmJzUhvfegFkVuxb8C3 otxu2TBkMqvL1kSyGPuoaq7fPSpLEVLR0ojAsyMSZ4nqj563rFT7eusrlv+nuy7StttxG/ 4Nl6s+WF3SAKEw2k14aQlre8X+jPN7PJqkNZL2IsrzQJ4CFJ5S485X9BZrxp0PKaiC4+2P zAfmlLinVFOV3ac3dQW6Y77uPK2bEZ0HAZSmD21OEQ+PIeLFW5GsYiFghl9s0ZN9f3g+u1 fBh1KeowldZn2bUFTp+OS6WV2WujZIeLGZtlc4OqZkdjatw0/66Q1WP3UA7SffPZKBqkOC cZwOJ+bo2jkJlzF/Pvh9wm96etzgZ0Imaf7CLyxHvKNNUVDPg6KbaWuGrvVPzSBVqspjnV uczcQxBWduc4cGEl+9wbve238E/rmkiqry5XN6kA9G5PuQgj2C+mR9gt6z6AWVTxp36OO4 cWTreQcXeEwZQE7ow+UFrMhtWjEC05gJAITJ8Q7VgAW2NQX/xZ9vPjmySS3WaQvmDKIaOO YzoK3suLwx+boLqzIVcKsD0Jls+RU5jGX60W61Dm6YKAF/nZK5+/uX1kdQQWrG4F68tjzy Rk218/BLwJEy9NeV1HywEZ6e+Bcp1eB2pDj4133uW3ZVrRuW5dDXqWW3WrgbYa8s6ErtVr vffR4yrP49AwpQ0nU1xoECeRRQeomUMnFsHtJtm6fNWB2toYGtsK8gUJXlSgvIHRkDzoRa RR6n14ui7H3d+dbmd0qD35oSarOQ8ldekc84R8X/3ooSU= 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::6f; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131811730158500 Content-Type: text/plain; charset="utf-8" On some CPUs too old for Windows 11 (Skylake) support but running it anyway, WHP advertises nested virt despite it being unavailable. As such, make failures to initialise nested virt even when advertised non-fatal. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 408a1667e0..d13513985c 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -3302,9 +3302,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms) &prop, sizeof(WHV_PARTITION_PROPERTY)); if (FAILED(hr)) { - error_report("WHPX: Failed to enable nested virtualization= , hr=3D%08lx", hr); - ret =3D -EINVAL; - goto error; + warn_report("WHPX: Failed to enable nested virtualization,= hr=3D%08lx", hr); } } =20 --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131765; cv=none; d=zohomail.com; s=zohoarc; b=DYBVBnzxQmsnRzyMZSsH4X4DDKsaQspKnG4Nm6WwMrx0cMbeM1KcrXTJqB77yF0V0tyuhB4EmLdE89HnvSvk61l8ZPliusxwvabEnGVLVz/jHkLAV54a/HitGOs+c4Xw+EHwXfRurX0X//lZ7VLUcTKP6Yi6DhPvTckbzt/8kaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131765; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M0CJ8m1tE45aGnGPaASxvBBsdpDz2YYKmBv/2eZp7xY=; b=H5EIk/xPdDbnMvJJYufY++CGcrbCz15U7u+ho9iyG+yVCPu/s8DnQsJNkhN9ow9zbcweVZ3lMXYfszQ8YT+zGqpJ5MiS6MutOqVTwzFKHR0Kj9zNgBk3LWsTjd3T2/DOOMbmViM35Hwy4iLZHpUYUP1ZTCqoKtlS/Id7xnciINs= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131765602780.1221561932917; Sun, 8 Nov 2026 01:56:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzci-0005sq-8Q; Sun, 08 Nov 2026 04:55:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbO-0005Rz-I2 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:18 -0500 Received: from st-2004a-snip6-10.eps.apple.com ([2a01:b747:3001:201::a] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbM-0005z6-Dq for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:18 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 64FD21800198; Sun, 08 Nov 2026 09:54:13 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 0C50018000BD; Sun, 08 Nov 2026 09:54:11 +0000 (UTC) X-ICL-RepId: 01a1ba94-72cb-7d9a-931f-e7d3a75a86d8 X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQRNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGCl1UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131655; x=1825667655; bh=M0CJ8m1tE45aGnGPaASxvBBsdpDz2YYKmBv/2eZp7xY=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=Agmg+wX7/CgImoYoVdj0J9YMieauUcZe256rIAX4bmc+SE/yOZHKAIx2fzAemeGQFwsIzcl0KxFmdl7ROlCwxrNhkKnyR541E7XYz9aEtqAjnCM0B+vTclumiVZLQ02XNY1E+oTQqw+0g6REyxDDFdYJvPTDWEZJHAeVHjA/EzX49pZv68Ikelpmelto0QlbUnHaK/BNl55nPr8uiIphOlvPWppW/900Ml08wR7EF3G3PpHI3aOqr0RWVziEG+NYGouP0eF4tNtpwb4adLRK5JPJsuCNIYMX2S+DHXZcLAdEcnHoz0glQUO+plBMOhWa+ZHCqly2ioqY+M7f9NbQNA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier , Boden Randin Subject: [PULL 07/13] whpx: i386: avoid updating hflags for vmexits Date: Sun, 8 Nov 2026 02:53:57 -0700 Message-ID: <20261108095403.70813-8-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: P_SIJRJy5OPnvr-If6nY9XbEDn4SzfiH X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX7l67fJCoKHT2 0AOMJRzBDS96paKMnMK5td8o9eH8kX93Ma5gJFTfzHm9XPG8LdTR2pNNRY+2b8J4WU/uU6RQL6h W8JFPVEHBYwZU9Fkg4+ASNPcv50GEc+ZF3Oq2RfsT/AP9WBKfr5oApfPIz24sIW64B1JQuCYAuj tNHdyrtz3KuUgodZJO8/M9bLimS/wOuyvTj2Kv65lGxC+kgvZLlQMmisvjOxmJf4X94QoAPc9UH GPf0NMxZHm8M7lGu4XSI+4sR3cFZxiqbt8d4MAM0Jnp8ZJLGRLYL7tefN+fILklPpFzQY68GfBr uGLxASwZPCK9ykWJ8dbtHH5CRq/Mj7MxiypP9vC7NHlc1D3869Q6i1JTdjhpKg= X-Authority-Info-Out: v=2.4 cv=Kd3fcAYD c=1 sm=1 tr=0 ts=6af046c6 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=pGLkceISAAAA:8 a=JvUqhf-O7Ua7-JxK32kA:9 X-Proofpoint-ORIG-GUID: P_SIJRJy5OPnvr-If6nY9XbEDn4SzfiH X-JNJ: AAAAAAABDMbhn5pFxH86WZmHoZllfB0umoJJHocNDZPsZyEri8M4GDhWbRuQb/B2Ptw/Ar 9fecgpgSgSN5787uqvy8KaOd2kQms2Fx/QcF65eYimbzAxYELXy/rWlGxOlQNeX1Lxy8Eo R1dC/JJeIZmpxBZqv6WhIuqid6Bgc5U+x1eNu8knIroIp9LJjl25TlvkuhtCdI+wjEyUqH X/vUSxhJ+EJrYWKQDRGxpXv2ZJu9xdCVbG+gJt1kaUWVX3WjB22Tq+XFSpvnlI/JvDEBdt 5SfnrxF23s3LFKzm354HCCNxfSIFpykv04mIQuRU+xamh2gY4mJ45wHs+tV9ARd8ZrZ+Eb O8X3Zu3D4D9DYeZHnT5i0Nh4uwphGqgoNVP9ZOu/ChT/lh/2tBtnE9+GFCpBPuyrw/diII ELxi6jiIhAhcov5QKxnUvSyIe1osU+Bp8flAeIGIGftqYbuJzRUb7Nfk5gQFdrGnU0qb06 2v5umHtMic3ViW7pggC3wsaE7hq0Ik0yOqVvzrL+4l26oCd+VPHm1axMHi8Vmsw8Ih+reQ M8cr0tCLSulqDehNSH2Y/djqQGLAWetXPwmrj12vHLlzrgIJdZ1kJDL5RU5TdrU4DJXeil G92EQ5aQVIAy5OsngbXPnF8cHLTiP4JQ/1mlZXCdIwSXrkJ2USFI05RYeALc5nthPqWS5V rrpfjXjQCin1/LzaQk6sw/ncJbi6HGgt2E7PjWTH4o1cP9K41eQHhlPhVT5C7uEL1IdH9Q OBTAKga8i0FqkSBpf6XCk5++2ZOVG5Ce6cNWqouDJ7EihjaSLCcq8Q58ejTPtXB2Lkqg== 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::a; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131767579158500 Content-Type: text/plain; charset="utf-8" From: Boden Randin whpx_get_registers_for_vmexit only refreshes GPRs, RIP and RFLAGS. x86_update_hflags() depends on state not refreshed here, while the code using the fast runtime state does not depend on the hflags it recomputes. Signed-off-by: Boden Randin Reviewed-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index d13513985c..65e56d32fa 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -772,8 +772,6 @@ static void whpx_get_registers_for_vmexit(CPUState *cpu= , WHPXStateLevel level) rflags_to_lflags(env); =20 assert(idx =3D=3D RTL_NUMBER_OF(whpx_register_names_for_vmexit)); - - x86_update_hflags(env); } =20 static void whpx_get_legacy_fp_registers(CPUState *cpu, WHPXStateLevel lev= el) --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131765; cv=none; d=zohomail.com; s=zohoarc; b=BTNFFhfHpiCLzscElWIMk4jXXpTylD4JCV3yUiioEohATVw9kxxd6Bf/pKHvc53YNiSwmI2fxHQ5nRQPNmql+E/QsyWklT2XOiUpwGXfyrpWHh3qLxqM12G1CkpQGeX+kUvu0v1EaC+sZtPvmDhDTZJvGvGb5xsqYs5Y4A+iHCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131765; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wo2d6b0m6ni1wsjawaHa8l8pEvNeTotsxA456Vufm2I=; b=ekay4PIoAdV7ww6Bl8/4cup5L+0HugdjfsdeV+HYF7NS/jdECbo7YRN5aVvNmd376Rk//uMHZTw4RBIZskCa5jPIun7BwH2XHHQmcICScBmyiLMLSl/+KwmeYlKf0Uszq0xNrHJMAIA2nIery+tEaQMjOEja11iEzyJKWPpL2h4= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131765830248.66850363844821; Sun, 8 Nov 2026 01:56:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzca-0005ry-Mp; Sun, 08 Nov 2026 04:55:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbP-0005SA-0A for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:19 -0500 Received: from st-2004c-snip6-11.eps.apple.com ([2a01:b747:3001:201::1f] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbM-0005zE-Hh for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:18 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 365C418000A0; Sun, 08 Nov 2026 09:54:14 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id E5EAE180019B; Sun, 08 Nov 2026 09:54:12 +0000 (UTC) X-ICL-RepId: 01a1ba94-75f9-7b32-9d28-7dfdee9b4b4b X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQRNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGC11UF1sMWg5WMEwWQx9SD1sTTRlRAVJFVAIHWEcURw4PE0wLRwJaNFYfVBlaAw== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131655; x=1825667655; bh=wo2d6b0m6ni1wsjawaHa8l8pEvNeTotsxA456Vufm2I=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=FlPBgVXtPzA6B5TSGYfDukjEOywrDneoBvCOvswmdC0Z798mjcoqiw1/7bAid4ffmBnjlf7P/uv61vIa25GEOfWi94K/sxE2KeNoemwqg+GmOX08NDDVczdTTvDswJCXlixJHn4mhknz4ab/zY7otss8NaNiKOYvn8pVIODYiPP3blSD3CzTQM1JtLZL4tZFCfKbnzeqAUMBYIHMuxdvjDy8/WymZCTtPfqWJ2muLTJUpcQg2qU6T0FtWGNYV2o0hSWPJCUl2m7A/ZYIbv3WaAp63VlT7hHqXd2n4/vA8ZnAH8Cv7ug4TEqMY1LJ/oiNmqUTffSkeRqqD2hwn1dxrQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier , "Doug Cook (WINDOWS)" Subject: [PULL 08/13] target/i386/whpx: handle processor reset Date: Sun, 8 Nov 2026 02:53:58 -0700 Message-ID: <20261108095403.70813-9-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 6hd7SpMIGGFtbFAMk20RfsFtAAmKlb18 X-Proofpoint-ORIG-GUID: 6hd7SpMIGGFtbFAMk20RfsFtAAmKlb18 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX9Zr0lPXJas9J seO3Bj56Asol2zvgoOrN0eH6x6RuLMOF6GDXDVUuJtAdvneEWYrH3k1Aic1MyX/xPJa2jQDg2kK P9dcSZCP3aNIJbTwzbJx6pzG4y3W/vkWECuqV1kgmewVzMYAPzlzwShsASCcVlWlnneAbA69xmE fL/E7lgPweSkonJoKM/2xM9uKXI/BoLQf5fy/8PlZAVNi3DkMrmk+3whOvsDgha1dnrxBBrA5bn tSFxKRp9UO80s/FmMhPR4t5S4kzoCOHmtfBNCfXFDsbPgvC8BEwaf1HA7U7TpMGznOMBKHpS52/ sX8dtqL95OEl/Cn6SlLXcBRWrK3qrriF1heQh7hrqCgyGGckdvX8Ax9oAltTXk= X-Authority-Info-Out: v=2.4 cv=QfJrf8bv c=1 sm=1 tr=0 ts=6af046c6 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=p0WdMEafAAAA:8 a=yMhMjlubAAAA:8 a=eqzMyDhjfWJDk1Qr7fMA:9 X-JNJ: AAAAAAABWrmwPAwpnJQT9v130BeZygLoNiQo/rKAbMb03dwGzaFmwGpppma2FurMCgrKaD klZ4OQQC8w4y7PJ2o8W+XqqFC5Q3R/yMZ4pNmqpxCIVRU4P1C8bJSYVPgqCwr4frVMJPyD 5VUugSXxoYTR5/ZxAaR2gjz2ybACq3xFC8ZJmfW/Ku9/aCh7N4r22x+J2ywo3jbpZ7rNIy clZ7JBKvgXTr9nMtGoEU2U/+myawLHmpEs4Zkmt8Vao8YM1YAAY2qKaIdThdeMX3eH6oYb +tzoigL7IdxCw/c0qS9tMI6fS0bkUW8CeoulChDvJlgEt+bjQESCL+jJiYXLzhuH8twq3B OD1iFBTaLkalXD7yv6hQBKOWwtIlfK0deG7rozsz0Ta8UQlhsDxIFQ+j3dqlFjLt95IUl4 UR0JJxC3XSBItHVzyJA+CIH/u42jA5fZsAYK2kpfW5VYhAOj5rLJWO1kC3b+0lw9gMy5vD LEOko+0EHdYXcHMwLu83hBijRju/QTinoSHTKRtklxLGTKtvbIkgAB5Wtn+YCrQAqLICUA GgS1eiSca1iPRqsIN0Pejm9MsoEWl+1Lo7GjVrPLwgcdxfMpDOwiAJDQKlURlA3SfcMNxA OA/TvUDMxfjTO5wqZLR7goOQZ+uQDwMZaY6Sa5h0Al4oHLmcSrmEhMJCFev7Y3D10eViMh x14zyh/tqpSv/Qvk2LfNhONp0Epslg/dOTxkcyCOAgtr4ASuLu2Xvsi6n0kRGh06Ty2KdU lkGBRcndXh6XAk0o6sxKC5npdu4yYami/mWF0kfo7BCUAp0Z8o9tp9vkaE5Fj2ilo4vh3G 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::1f; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131767604158500 Content-Type: text/plain; charset="utf-8" From: "Doug Cook (WINDOWS)" WHPX is not properly handling processor reset: - Does not reset partition, so several registers (e.g. Hypercall, GuestOsId) carry values forward as "Locked" into the next session. - Does not clear hypervisor-managed TSC deadline (live-lock). - Does not re-arm the wait-for-SIPI trigger, so all CPUs start running immediately after reset. Some firmware may tolerate this, but OVMF does not. Typical result is that boot hangs or ends in triple-fault, e.g. qemu-system-x86_64: WHPX: Unexpected VP exit code 4 After this patch, I am able to boot to Windows desktop, reset, and boot back to Windows desktop. Tried many times in sequence with no problems. Used several different reset mechanisms (OS shutdown menu, external "reset", watchdog reset) with no problems. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2402 Signed-off-by: Doug Cook Reviewed-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 65e56d32fa..12c6c3001e 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -541,6 +541,35 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel = level) =20 assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); =20 + /* Assumes that cpu_synchronize_all_post_reset() runs cpu 0 first. */ + if (level =3D=3D WHPX_LEVEL_RESET_STATE && cpu->cpu_index =3D=3D 0) { + hr =3D whp_dispatch.WHvResetPartition(whpx->partition); + if (FAILED(hr)) { + error_report("WHPX: Failed to reset partition, hr=3D%08lx", hr= ); + } + } + + /* Reset hypervisor-owned TSC deadline. */ + if (level =3D=3D WHPX_LEVEL_RESET_STATE) { + WHV_REGISTER_VALUE tsc_deadline =3D {}; + + whpx_set_reg(cpu, WHvX64RegisterTscDeadline, tsc_deadline); + } + + /* + * Re-arm partition's wait-for-SIPI state. + * whpx_vcpu_run() ignores cpu->halted, depends on SIPI for this. + * This must follow WHvResetPartition. + */ + if (level =3D=3D WHPX_LEVEL_RESET_STATE && whpx_irqchip_in_kernel()) { + WHV_REGISTER_VALUE activity =3D {}; + + whpx_get_reg(cpu, WHvRegisterInternalActivityState, &activity); + activity.InternalActivity.StartupSuspend =3D !cpu_is_bsp(x86_cpu); + activity.InternalActivity.HaltSuspend =3D 0; + whpx_set_reg(cpu, WHvRegisterInternalActivityState, activity); + } + /* * Following MSRs have side effects on the guest or are too heavy for * runtime. Limit them to full state update. --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131790; cv=none; d=zohomail.com; s=zohoarc; b=b2TPUj+4riXS2j9PoC6NUHB2BkbOo+bRABjD9IB9EYXLuuPQw4qjqnxxhw3V5u+mxuuLfr5nmu+rs73DFerpPEIYRILWCMg0PSKxvyek4zGAHEuLYlq1OpyRz/y+7qBX8xKVlK0zB38s7gtCOmPiQCVUhEQXDEc8IC80WaY3ExM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131790; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=93j8GFn2aIN5NvK8Y1HIzwXcuknIx3xv/zkmLcn737g=; b=YC+J2dhb1d6yxmZPAW0JSXa5gsS/BXq6r14BWPRsYq/HyWl8zpZyAFYP8Uv1jtaFjYaZsXT9Yv5mDIrhwWJa9iyGZikHMMKtIWkalHgzcQiQnBZfHZ9fsCei/MqCeujc6VK+mUxafEmt86EIRLUM5CVZ6Tqa4MiUSFaoTpFCrSg= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131790096821.804948133918; Sun, 8 Nov 2026 01:56:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzd0-0006T2-Cq; Sun, 08 Nov 2026 04:55:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbP-0005Sm-Sq for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:19 -0500 Received: from st-2004a-snip6-5.eps.apple.com ([2a01:b747:3001:201::6] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbO-00060I-F4 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:19 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 38E2E18000BD; Sun, 08 Nov 2026 09:54:14 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id BB7C718001A4; Sun, 08 Nov 2026 09:54:13 +0000 (UTC) X-ICL-RepId: 01a1ba94-79c8-7b62-a89b-088799203eaf X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQVNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGA0AUFVwFVgZXFHkNXR1FDlYZWgxSD1sOHBZLRhMZThtXTVoNQBlYBm0UVhVSBFk= Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131657; x=1825667657; bh=93j8GFn2aIN5NvK8Y1HIzwXcuknIx3xv/zkmLcn737g=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=Bd9t+crpMPA8yuxFcxqELciBM5ldjQfe82vl1LbAyfwAlP/iW0xe3uHLwce2eyc+evQ+iD6PmO+5FE2jbiebvZd4GzPIT4o6zYxAnfRh0fFSCFrELzld/S1W6Sz1Dy4yeO1UvrrSE4bfqJ5NWXdpzRO9h6otMxuHiVVMfnuCallgkrW3VO8Il+Wy3/vAXj+AKJkygLiBCRIYNNmqJFuKRdw0NS6G4K4Q1uC0TwW4+YQmyFIBxDn5aLTDlXk1VYn35IDnzptyQLtYNPvHVfIhHHPThznjgHT2AHcj/lG+M+1lV69S0L4KXi/xXkMrVZF/FZ7SApjtwz9Hn+0d+CPuJg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier Subject: [PULL 09/13] target/arm/whpx: handle processor reset Date: Sun, 8 Nov 2026 02:53:59 -0700 Message-ID: <20261108095403.70813-10-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: Zn6bl-RxyLvFymU4LsrV4YRVzAu14g7m X-Authority-Info-Out: v=2.4 cv=K60v3iWI c=1 sm=1 tr=0 ts=6af046c8 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=loPyruWHUH_f1C729x8A:9 X-Proofpoint-ORIG-GUID: Zn6bl-RxyLvFymU4LsrV4YRVzAu14g7m X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX3MOk0sJt/4o8 Fat1qizeLrIs8IpcyDF8cCGzgakeRTZtJwRSbsnv/wJy8o91Tz3KY3CaxZUk9AmeQHsqq6xbFDE NmW04t/Uakol5wim/skQIj3k6RaiuGzIjSOnd0lXW5qlQAUA+Hp2tSwXZL86z4/vcwtabEqUgsW UTQfg8FZ6iVUak9Y2S7aPa15kZ9864gkx/qaV7nPfTC+WTlUI4qhM4JwXpu4JuVubOpbKjeRU4r 8+nJFoXnMm867ZBvlL+J56l12g3V3nUzTvw0nKYe0Lc+Vgz5IIHWy3Tt2N734S5yz4yh05kRTHE oF9Ot/Q9Wvm9KxFxk3EB5yPbKHFHXHIORdX4lW6bepyt2XwdT60BlvaVGp8nbs= X-JNJ: AAAAAAAB3/2PySQ5LpzXSkDt9Rx19MNSkHTAXZe9kq78WHGCvVfaKgpKOAYUtv5HjuA/wY 183+iUIkHHKKa2ud8JsL9loXnj6qG+ijQPFidCzeK9uGFGjZSo44uc7rtpOsxaXa+BY1q2 cJP0WNMC1Sa57zjou5oRGP5Ey9j/tUUbx/RSo9byxT62R4BZcDGHxHumZwU7t/Rd7L3Evi MA9awvoY+S7r7vpPJryoJCHGWO5X/Rtk3++aMOEhD6kJrQK2MIzwAUMSF/NKs5I6j+CFgn 2ur0Tk9nBDYfw05RhsBY5f/G6+PkOUOow1iEMG+G0HumM8NYBwfIzPrxqsFYZ3cPycEmpj VRDe1JYge2JpdxYTposcsQOG0urclQw5IqS4U1JptvCaiJoTllAvsUGh5okRYSKj9q5WOp 7RSMwFmS2SlFSE3DhTBVjbY2xAVbhsvLJ1rHGvgTImcqmnXSoesVaCLW2KtuCJNc+rOpl+ BEqbZ8ZSBpV1xKjRobNTAMpepET4I4ID+XgLvlu1yWg40sLtfH6y0wQUJ6Wy/renDLTHob pz3o2EUYKuRNiL1EMDD16hgv8o+LUBDmKK6TNFhfFD4rBdDhaa51oqVn00Gb6SfWYfH0UE VtgpoHxf3xQ5ZyOsRf3JO+gAVg5/1tyWpbmNSt2bqbunpbd9RnG8VOI4As1QCouXQbIuVK psh9YYYrJoCadIgry/5hvC9S1c1vGgqVzzN0h9Bz8k1vy7dE9ErZgXnxYFrvZDHqEHjBg2 FSBU1oHRJk6mCVQmPlIxtP 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::6; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131791385158500 Content-Type: text/plain; charset="utf-8" Move WHvResetPartition to where it's effective on multi-core configurations. Signed-off-by: Mohamed Mediouni --- target/arm/whpx/whpx-all.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index 46f0b9524e..150a6326d7 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -471,8 +471,6 @@ int whpx_vcpu_run(CPUState *cpu) if (arm_cpu->power_state !=3D PSCI_OFF) { whpx_psci_cpu_off(arm_cpu); } - /* Partition-wide reset, to reset state for reboots to succeed= . */ - whp_dispatch.WHvResetPartition(whpx->partition); bql_unlock(); break; case WHvRunVpExitReasonNone: @@ -573,6 +571,14 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel = level) =20 assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); =20 + /* Assumes that cpu_synchronize_all_post_reset() runs cpu 0 first. */ + if (level =3D=3D WHPX_LEVEL_RESET_STATE && cpu->cpu_index =3D=3D 0) { + hr =3D whp_dispatch.WHvResetPartition(whpx->partition); + if (FAILED(hr)) { + error_report("WHPX: Failed to reset partition, hr=3D%08lx", hr= ); + } + } + for (i =3D 0; i < ARRAY_SIZE(whpx_reg_match); i++) { val.Reg64 =3D *(uint64_t *)((char *)env + whpx_reg_match[i].offset= ); whpx_set_reg(cpu, whpx_reg_match[i].reg, val); --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131788; cv=none; d=zohomail.com; s=zohoarc; b=jNxWi61jkKLkwy7gTOb3+i8bpOFk8rxBVmmGWIkltW0wDgMyalTsueGHy8W6OPNaNgg5bXOXbvDXYFY7fsFhm67BdN/mxqPCtu+wiDlHJCu6KkAPgqyLhaZGXSK/YSSSeDFFCOROz+qbRchxzVwFBctMv0Fh4ljHtccssucw8cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131788; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xAHareLqRcQoibk/pUl7iu0EJCRWnVfvRebMKQQfl6Q=; b=jV05P8KSH1TIFjborQ+dXCQepp9Xq7SrHRi4oAqjzybZgLuZ9epe5hGWcNyfIOcvq5E82vvhZC77iPVbxwRT0xK3Xy9T98at/wklSs6IpylLLbrIhm6WaWku531rwteCUgojC6T3mRqBl11D0skHNr9C5xpKPf4UWJ37LKaeA5g= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131788317291.18004170203744; Sun, 8 Nov 2026 01:56:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzd8-00076Y-9o; Sun, 08 Nov 2026 04:56:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbS-0005TZ-40 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:23 -0500 Received: from st-2004k-snip6-11.eps.apple.com ([2a01:b747:3001:201::6f] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbQ-000614-71 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:21 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 3622F180019B; Sun, 08 Nov 2026 09:54:15 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 7F90F18001BB; Sun, 08 Nov 2026 09:54:14 +0000 (UTC) X-ICL-RepId: 01a1ba94-7d8c-7713-a847-902e06dc1b40 X-ICL-Out-Info: HUtFAUMEWwJACUgBTUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQRNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGA0EUFVwFVgZXFHkNXR1FDlYZWgxSD1sOHBZLRhMZThtXTVoNQBlYBm0UVhVSBFk= Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131659; x=1825667659; bh=xAHareLqRcQoibk/pUl7iu0EJCRWnVfvRebMKQQfl6Q=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=s8xNFVNx8NioFqCK1VdhkoZtXNrGdYk7/yFbpCW87jhSN0L/UhDsNigX6b/5/pYZxWuoEe8y2FI7TZCNZtWe6KE61omW4+lKQQEgPPYFmustt9XfxVSL5rzmudGTi6QonhXFFAkekhLbgLheFvyQfXxbmd5Fij+XBdHLufhayuVNEqsVokWkgujccYW4tjqQgf7ANBEGAyP5viNwI2r96fj23V3+K2+OeNHLT5muCx6Fqk7WhP9EgWBBZ8ciPIbr7eMaHIhZNipZzVXL/iKeSJcbejbLan6rn8pofC1a6ffamVseYPXODTJ5xeqgbq8hVdwYq25bkIWpQ74gcrTf9g== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier , Kostas Chatzikokolakis Subject: [PULL 10/13] whpx: i386: forward the dynamic EBX of CPUID[0xD] sub-leaves 0 and 1, not 1 and 2 Date: Sun, 8 Nov 2026 02:54:00 -0700 Message-ID: <20261108095403.70813-11-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=D8FK6/Rj c=1 sm=1 tr=0 ts=6af046c9 cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=DGLFwGUCAAAA:8 a=RSavJFEQRcchf7d-p6oA:9 a=4cWXuvdlNTBkoNYRywza:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX9s3+L3d3Ott2 FIeCeJpMVasXqqZgNKvAEjzyQYZLO0MtlfiUKx/rI1XF7F8zxloZwz0yDGvrZTGLU68OS3zH/ZX 8H7LrJBSLxI1yUkd88zpsdcquazES4yiuxamKRdXlmz+HvNMYDaM/BISz8jgRJMlsEskREe32/W AcqreTUU75oQQay/JiZIUgZje0rCioLIPcv4UEbVHK1iROO9ljNMFRSQ6eGfP/cr5nSv7Y5xpYE SvoycS9wiimZIAWcKz/ITGrUP9SGJ9JDRVOyFVOeOv4PVsHmG/YlUBvgRagGgRc/ANB1UnAgsSP QID8HlN6qSwtn1oR7uRw7pOoiKcQBEoVg2w6CF6EFlDuLI23bnJpdjXQ2fRXcA= X-Proofpoint-GUID: -TbaS1l7kklSBk02Wb8qnPDL35A_Rd6y X-Proofpoint-ORIG-GUID: -TbaS1l7kklSBk02Wb8qnPDL35A_Rd6y X-JNJ: AAAAAAABUGeBxKkGp5Mu5WSUJ/dRtdk8p1JnwEz0r560MXKYQWm/XsMbtQ7McKB+72J1V6 sX+58gtdUtylijR/4hX/wQgOv2GzSZkqwnj13zwoWPAoxNxVaWYb79XOuOHMUlC70B90IJ FZqGe7tIgTKHM5itit98TGfLDsEzJz0fT8Iy36BLz9HyeNMOSHJFo/veqEklDYUM6uMKEN tgtowh8IwxjplSC8UdPxPodiaa+yOpeEg/p7oF+/nHnMhd568ISxB1QzXIke5hl++JFETG FUOVQ0PGCFNvLTxDuc/vxOsLXCXzPmshfWBK1Ll2BctDAKscft8HzYmIG8ggUS5mFOMO0t t3TfXpgXDjAHhXUzM8/Nd6w/MCfHja54/RrrhlUdS7N8RHZOZOEPdwABzmYDnoJjLExYWh PiWYPmvx2zTGySrLTbJ/U0aoN+TkMOmkEqnShbJHikgZaaXnX+/ELwGlm+ap4mbPLv13Gk aBQqsU5VyI69em5gPRQn6J9c2t5e89LGoCIAoZnWJ/UHf6fwb4b1k+dgMDK/4xmDX/jvD9 zE6eIWmUWi1ysEeetfY+C/DP2jdQzOvyyx5kE/ZjlLr9BQLjLVsqXlI/SI7HF68tcoRDw7 BIr4pwv/wdBdbqCm284M/nMAckfj5u3QSK7IkET1sa/gZ9vhJo0ywj6t55rxG3E2kjTqpb r4+rXGiKkb3O2Cd4pDH1L6DCpQY5w2c1sbWK4a7lnzsKll3IMhyE4P58SR/KQMRw5hDMR3 TILYrjWWrPYpNyTd1ktHJW++TT9bdMS6Q3iKKmALW6q9V2MtcvBRPAt9ftM2gSHhjmXS+U cmPW9MtFaFtLxL6vmVBFJOYBpzEl9EaCnrcmy5K59Q== 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::6f; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131789430158500 Content-Type: text/plain; charset="utf-8" From: Kostas Chatzikokolakis CPUID[0xD,0].EBX is the size of the XSAVE area for the guest's current XCR0, and CPUID[0xD,1].EBX the size for XCR0 | IA32_XSS: those are the two values that depend on guest state. For sub-leaf 2 and up, EBX is the component's offset in the standard format, a constant. whpx_vcpu_run() forwards Hyper-V's DefaultResultRbx for sub-leaves 1 and 2 instead. Sub-leaf 2 is harmless: QEMU's own offset was read from Hyper-V at vCPU init. Sub-leaf 0 is not: QEMU computes it from env->xcr0, which WHPX refreshes only in whpx_get_registers(), never on a CPUID exit, so after the guest's XSETBV the leaf still reports the size for the reset XCR0, 576 bytes. A Linux guest on a host without XSAVES takes that as its kernel XSAVE size, fails the consistency check against the size it computed from the component offsets, disables XSAVE and panics on the fallback path: XSAVE consistency problem: size 832 !=3D kernel_size 576 WARNING: CPU: 0 PID: 0 at arch/x86/kernel/fpu/xstate.c:638 fpu__init_syst= em_xstate x86/fpu: XSAVE disabled BUG: kernel NULL pointer dereference, address: 0000000000000010 RIP: 0010:fpstate_reset+0x1a/0x90 Kernel panic - not syncing: Attempted to kill the idle task! Every CPU model with XSAVE is affected there (-cpu max, Haswell, SandyBridge); models without it (Westmere, Nehalem, qemu64) boot. A host with XSAVES boots because Linux takes the compacted size from sub-leaf 1, which is forwarded; sub-leaf 0 is stale there too. Reproduced on an Intel Core i5-4440 (Haswell) under Windows 11 Home build 26300 with QEMU 11.1.2 (the code is unchanged on master), guest Linux 6.18. With this patch the guest enables xstate 0x7 at 832 bytes and boots with -cpu max. An AMD Ryzen 9 7900X under build 26100, not affected before, still boots with the patch, enabling 0xe7 (compacted, 2432 bytes). Fixes: 79b3cb1f0145 ("whpx: i386: introduce proper cpuid support") Signed-off-by: Kostas Chatzikokolakis Reviewed-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 12c6c3001e..1790b1c7b6 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2733,10 +2733,14 @@ int whpx_vcpu_run(CPUState *cpu) } } =20 - /* CPUID[0xD,{1,2}].EBX are dynamic depending on guest feature= s. */ + /* + * CPUID[0xD,{0,1}].EBX are dynamic: the XSAVE area size for t= he + * guest's current XCR0, resp. XCR0 | IA32_XSS. For sub-leaf >= =3D 2, + * EBX is the component's fixed offset, which QEMU already rep= orts. + */ if (vcpu->exit_ctx.CpuidAccess.Rax =3D=3D 0xd) { - if (vcpu->exit_ctx.CpuidAccess.Rcx =3D=3D 1 - || vcpu->exit_ctx.CpuidAccess.Rcx =3D=3D 2) { + if (vcpu->exit_ctx.CpuidAccess.Rcx =3D=3D 0 + || vcpu->exit_ctx.CpuidAccess.Rcx =3D=3D 1) { reg_values[4].Reg64 =3D vcpu->exit_ctx.CpuidAccess.Def= aultResultRbx; } } --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131798; cv=none; d=zohomail.com; s=zohoarc; b=ay0RSj5P4SEDUsZ5BG23f6FA7cnjHmKQVFSn7ejyiXhHzdUMpGMIp7CsHLuxtVkGBd+0G9hSMY1Rh7IO5Fyiqe8RsMuMFqyjvJDOEkO+7CkzY2vCgi9y8YLnciUi2lX7r1ajYIIHAI6pRsC9PWqSx4e92EpFp2LV8KQxH6GMI3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131798; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vnx12hWY372/I+Rub5yA74xV6JLVi9u6a26PjApLWjM=; b=SmZWHWJ4OT7/rATEQ7LmmJVLdxtSefyo2xuffjrhBsYh57RZIHmws+hhUDK458qE9HnthBHaf2dwrFaD7qXZ2uiL3TVyPxoQKG2T+oVqJhyrMyx24PI8mv1URnB6l3sZciDBKvorseM+9xI0ZVMCg//vUFyeB/+3yeIg0pt5guE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179413179849415.566049882700554; Sun, 8 Nov 2026 01:56:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzcy-0006JU-8F; Sun, 08 Nov 2026 04:55:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbT-0005Tu-9V for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:23 -0500 Received: from st-2004i-snip6-1.eps.apple.com ([2a01:b747:3001:201::54] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbR-00061f-6W for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:23 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 0E60E18001AB; Sun, 08 Nov 2026 09:54:16 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 5804218000CF; Sun, 08 Nov 2026 09:54:15 +0000 (UTC) X-ICL-RepId: 01a1ba94-80d2-7f79-868f-5f2dffad2765 X-ICL-Out-Info: HUtFAUMEWwJACUgATUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQRNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGA0IUFVwFVgZXFHkNXR1FDlYZWgxSD1sOHBZLRhMZThtXTVoNQBlYBm0UVhVSBFk= Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131660; x=1825667660; bh=vnx12hWY372/I+Rub5yA74xV6JLVi9u6a26PjApLWjM=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=zReIFCcZA0CWyTwtkoMxEBWMD5019V2Nx//TnDOBi8t5Rvdl85gPiOhCVyRecpzdlG3Ff+0qLMIIwDvXPvpvKlsp5GO7t6TfShl0A/u5W3uegak7zkowt28EXdNAnR6ov0IcWMsBI+5hfv7sVKoNGCYLV+gb0ekGs4KR3nesowpqNoM3XNmM3daZ3PjsgjriI+Rwn33qON3EAKR9djzyqCcxShRSa1yDvyLbRhaVbAKerAUZ5bSudAHCWK2/4KNNOv85UfLY1DQ1vgcDjSMiR8An4qqWVc1pWb2MwtYRraffcAtbUgbm6zd0lF+UL8omNlsVOgGAH9ExNSrQ6Urt7Q== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier , Akshey Taneja Subject: [PULL 11/13] whpx: i386: do not require ProcessorFeaturesBanks on legacy Windows Date: Sun, 8 Nov 2026 02:54:01 -0700 Message-ID: <20261108095403.70813-12-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: _XyI6T1xMKkGnXATy-kqg_TmByOQLbhO X-Authority-Info-Out: v=2.4 cv=K60v3iWI c=1 sm=1 tr=0 ts=6af046ca cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=pGLkceISAAAA:8 a=gf5HlC0yx7l-uUfkWeAA:9 X-Proofpoint-ORIG-GUID: _XyI6T1xMKkGnXATy-kqg_TmByOQLbhO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX/uPG/ABs8gHs cIh+aLv0M0Nx/WBkkfi9ZjvVE0p6JyT/UWNxLKUHGeKkO6wfjhaC3DBu9aZk1rcsFVNMxvNtZDo Ig7wYQtu5ZmpL0CtvxI9i2vUPkbH2asmPScNFH1E2fUZw4hMALxC8L7O5lXgOOfQPcsRmF6nbbq 9nlMeJB6NJjV8E9hUclJtlm+fMld26RvThq1U09eI96Icy6PnlRueb7Yq54+73wqtkLlXoBwPl7 v0S8HDspY62ohiuAxYzGIIv4DERCYKAMkwRq11ex0EFoRYe2T9v8zTvkvgjA6TuCPaNZFuY2a63 +eOYqsRjVRBXMNkrXWAWJ0Z3D4Engdn9z+jIc/Z7mZc4jS5+j7J7L00PlCtcjU= X-JNJ: AAAAAAABLYn6O7VZeBGafSE9qm0NbjkwfpwvM8cxZIvYK71Zq2bhycVm/Vh5wY2K/rCpuq XzRKpL0+ysdJgWJRA899epCQ3644Dl7SSdk3zTOOHM2PRo2ToXIfv+rgu44S6Ei/mRB3gk WtQn+HIJovGQVgHSb25FqA2qOLFEnGDecrzYkPZ+mN61BoTeQNqBWTuMDNyrDTs5FU+0GH RJWwrBu4XrTnIevzkOJdprwRYMEe+MmJ/Ax8yJJPfzpnOh+dLaV8PSE4aOOOwWrzuCpsZy DpN0ao+Djc6Ph8pfXrdjUAYKvhc+bZ1hYKIGobpff/065/CW46RTcKvGo3sw5mVMWAz/Gc nQpZQ8PPz7/W+LBvH0pM6y31ZuuqY4bHabGYJi46XzY9A53lD+CZc56hkHkaIZJGS8y6ky QkXUsr0LcRmhczZV71rWeacrKjThsnPzt6OgZgLObFh475ng3zlrIonqNeQZQBWiinwZIa kGvPNnmySkF0/vrqry1RmBi8F7plY44ZE3tU0G/PPWPDL11oE0V2NZuHF5sUhTGPVf0l2P iwlSfOWSbub02vABtxI1RcZvRn+2qZs9a7xHE2F/1SaLbd8MOX3CRPRaXFKxLxE4/CJdW6 z3E6i9ZlCq6211496alVzds06xYPgCCXwi+1me7nWcPp7O7G/lxClHGQfVON4CRpMlPsYL 3fSsOYCpfdQHSzyWPOAUWTVsgguXHSky+GA8u8stygJWVd94jhdT1hvrQQ+thSSTusIkEr 6LHgToQ2Nc6KWCZPuF9oNlSdYbd62y2M1xjnOSDzm3gJtl/6dzTjfy5Ucvb4dYW7XsMSV5 GX6YV5Jdgx2SRbO7sdTAmXZzPcS5yeGhfzKMPfK1g/ZWU5KG5zCuq+tOM3g84j2E 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::54; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131799537158500 Content-Type: text/plain; charset="utf-8" From: Akshey Taneja WHvCapabilityCodeProcessorFeaturesBanks and the matching partition property are implemented starting from Windows 10 version 20H1. On earlier Windows 10 releases, the capability query returns WHV_E_UNKNOWN_CAPABILITY (0x80370300) and whpx_accel_init() aborts with -ENOSPC, reported to the user as "failed to initialize whpx: No space left on device". This regressed older Windows 10 releases in 8b87283ce4 ("whpx: i386: enable all supported host features"). Fall back to the original single-bank WHvCapabilityCodeProcessorFeatures on legacy hosts and skip the corresponding SetPartitionProperty, which restores the pre-8b87283ce4 behaviour there. Reported-on: Windows 10 Enterprise LTSC 17763, Intel i7-6700 Signed-off-by: Akshey Taneja [Editing patch for reflecting the availability of this API, which is available in Windows 10 version 2004 onwards] Reviewed-by: Mohamed Mediouni Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 59 +++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 1790b1c7b6..f40409b330 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -3312,13 +3312,33 @@ int whpx_accel_init(AccelState *as, MachineState *m= s) memset(&processor_features, 0, sizeof(WHV_PROCESSOR_FEATURES_BANKS)); processor_features.BanksCount =3D 2; =20 - hr =3D whp_dispatch.WHvGetCapability( - WHvCapabilityCodeProcessorFeaturesBanks, &processor_features, - sizeof(WHV_PROCESSOR_FEATURES_BANKS), &whpx_cap_size); - if (FAILED(hr)) { - error_report("WHPX: Failed to get processor features, hr=3D%08lx",= hr); - ret =3D -ENOSPC; - goto error; + if (whpx_is_legacy_os()) { + /* + * WHvCapabilityCodeProcessorFeaturesBanks is implemented starting + * from Windows 10 version 20H2 (19041). Fall back to the single-b= ank + * capability on earlier Windows 10 releases. + */ + WHV_PROCESSOR_FEATURES legacy_features =3D {0}; + + processor_features.BanksCount =3D 1; + hr =3D whp_dispatch.WHvGetCapability( + WHvCapabilityCodeProcessorFeatures, &legacy_features, + sizeof(legacy_features), &whpx_cap_size); + if (FAILED(hr)) { + warn_report("WHPX: Failed to get legacy processor features, " + "hr=3D%08lx", hr); + } else { + processor_features.Bank0 =3D legacy_features; + } + } else { + hr =3D whp_dispatch.WHvGetCapability( + WHvCapabilityCodeProcessorFeaturesBanks, &processor_features, + sizeof(WHV_PROCESSOR_FEATURES_BANKS), &whpx_cap_size); + if (FAILED(hr)) { + error_report("WHPX: Failed to get processor features, hr=3D%08= lx", hr); + ret =3D -ENOSPC; + goto error; + } } =20 whpx_rdtsc_cap =3D processor_features.Bank0.RdtscpSupport; @@ -3363,15 +3383,22 @@ int whpx_accel_init(AccelState *as, MachineState *m= s) } } =20 - hr =3D whp_dispatch.WHvSetPartitionProperty( - whpx->partition, - WHvPartitionPropertyCodeProcessorFeaturesBanks, - &processor_features, - sizeof(WHV_PROCESSOR_FEATURES_BANKS)); - if (FAILED(hr)) { - error_report("WHPX: Failed to set processor features, hr=3D%08lx",= hr); - ret =3D -EINVAL; - goto error; + /* + * The matching partition property is available on Windows 10 version = 20H2 (19041). + * and later. Rely on the whpx_is_legacy_os() check to enable this cod= e only on Server + * 2022 or Windows 11. + */ + if (!whpx_is_legacy_os()) { + hr =3D whp_dispatch.WHvSetPartitionProperty( + whpx->partition, + WHvPartitionPropertyCodeProcessorFeaturesBanks, + &processor_features, + sizeof(WHV_PROCESSOR_FEATURES_BANKS)); + if (FAILED(hr)) { + error_report("WHPX: Failed to set processor features, hr=3D%08= lx", hr); + ret =3D -EINVAL; + goto error; + } } =20 =20 --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131819; cv=none; d=zohomail.com; s=zohoarc; b=B+TMbsKYdBecgAdx+HM4dbBYVgnzQdrukv6QfU/wkZdDumX5AKoQyZPhoQE6CdsU0QBqHICoDn4DEX33sDouUjZS/ogOBS8RskG0XsJxmf65cvbfJ64WbBo8QZQ9AJoTILGXk/Wk8Mf0AD9nEfqtPAOL0szSy48cuz68aAnbtr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131819; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rBqaDytTLQzvHs/js6ubTESPReuCXdmTqeK3frThc2k=; b=V+SswJIuEM4wDObapULwS/v3ktbck3QbvyVe06ujKH4s1L7ZumuK0Yb6+SL9fVuEl1sMCegdftC5H+eanAmmlTslZ2Y0SlflusCkfJu6KfO8ditl7wTOWlmJB4MPxVPFphJB//78wzR3V8/crPpiVeT/MXwVfYO5spd4XlqCd/w= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179413181995750.527203838862306; Sun, 8 Nov 2026 01:56:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzd2-0006cE-HV; Sun, 08 Nov 2026 04:56:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbR-0005TV-EL for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:22 -0500 Received: from st-2004d-snip6-11.eps.apple.com ([2a01:b747:3001:201::29] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbP-00060l-4O for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:20 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 664E0180019C; Sun, 08 Nov 2026 09:54:17 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 2E8821800199; Sun, 08 Nov 2026 09:54:16 +0000 (UTC) X-ICL-RepId: 01a1ba94-8280-7734-843a-bb352d765178 X-ICL-Out-Info: HUtFAUMEWwJACUgATUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQRNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGA0MUFVwFVgZXFHkNXR1FDlYZWgxSD1sOHBZLRhMZThtXTVoNQBlYBm0UVhVSBFk= Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131658; x=1825667658; bh=rBqaDytTLQzvHs/js6ubTESPReuCXdmTqeK3frThc2k=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=MsoOWVOt6lGHRMNTdWVnIzElO1evo9o3/N5k3cCYFsG0toftfP86xRHyao57n+zO429Y3u6QlcG1CsSVYW+duVj0Ikf68QMeb24T7gosp1OxvHuBj1Kioj4cClgjfMDfvyQa+wdgi0Rguv/1MChjcnXIshzkmv5WI0rnCBYWsqOS/yO+a2Eo0Fc9IpJzHezYIndvkSxmBjsm8wixN+xkwb4XQvhd55ZaeEsu0KmHM6IJtEzEuhcncDajy14UBWuB817xvxIYygiyEVYgsQvYOF3QLNlrb8HFsVcj9l2vDYUU+vWqDs8zluTLvqS8qn09fYceDFoMmZaBK9ilc7sb4A== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier , Akshey Taneja Subject: [PULL 12/13] whpx: i386: fall back to xAPIC when the MSR exit bitmap is unavailable Date: Sun, 8 Nov 2026 02:54:02 -0700 Message-ID: <20261108095403.70813-13-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: iSRCx7dfCVX0EifqZGyX19ly3aQICrnj X-Proofpoint-GUID: iSRCx7dfCVX0EifqZGyX19ly3aQICrnj X-Authority-Info-Out: v=2.4 cv=VLfQXtPX c=1 sm=1 tr=0 ts=6af046ca cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=pGLkceISAAAA:8 a=LzqnFUZUDoiWbgQmKAQA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfXxJTtGTzIWbpA o9FuYfvqiyidfCGZOYMF3a384iZFGrxwS/A1PQgzxjBLz7Uk8yvViuwt+7VXm83QoaM2eGniyRm /rWstlkr6BrwooPv3bCjZ5W8HPWdlLavX8MRcB7h0FrdyKyEKlAqzcjklyKekrlRyMVHQx2KYJE 74Xjbh6VeESc1dKrJ9wOQiy6BWYrv90t3Yhlr9RQK/wQgTWunIjuUDZxY/TAY0cE1vB1Uy5sMui TTL4GNYWB4buUnBCUdB2mGS3m2upldYFteeSBqbZAI8oXpRNV68QM0FtpSIwSajdyy/wFC+yU9N 1FpSpJDAMLhuc3ztWc5Pe3gSy6hsWuzFEtwVvGyk3WjxxymmdrG3muIpUztCHw= X-JNJ: AAAAAAABS9VgKkJykG88w+KrvLzvu9Bk1t0BsHTGwbHf8WB7zf16SUp5PUxeK9u2ATzejn fNsLypPaa2aigKtafg+bCI3gR1FnUdwF+ERAVlIE32Ayp9lDeq9TJUpU8GSaST+OHFVzs/ xWQ6AhxZFCvsUybDxPIMPNmw+9DN++gmD3/wIMam4DJ+OpGkZec5Z9we/fLfWw/x03QYrI wBmZddWlR59pzWOd0nhkeP5CFD9fw1P2Kuk9AeHNjcEhV64vIl3wr7oAOuKTmrYTjxudZi zLZF7Fr5l1jaNYeWSVftS6sUzA5ye5mxrglLomv9DGI+vi2w9qYGC5SPJ+FrDDTDk0Bbdz 1u18Plz+pqn9wozv25fbL12/xuL5R5H32S8qD1d/hoXPLBV1qTi+xefnHWQnuLS2WKEkQb ORQ4aOm2AMjiZQVohprrrchoxroIaeyZgpDlg6E2vFwX2GKA0bq+uhZrJbZeyryVA7MeyO rbo1NA5istvXg1HTjTYta6Sw8BU8hVQrw8HptWTKrQbzvo6cMD0FHmRINqeR8Yd4sODQio pkevomGWGbtry2fV4+GErLguB+FW3H7Hu/sSCTq4aUA7RGKCEUZcws8MK5sunLH+neLNcV vAIF8I9V4xK9Q6O8AbDHr/2OhiRI1qdyBkRNI5tAscdl+7rkOQhL0W85v58kboesBWfVtP pdm3EKeLGoOo5X8VOscrb3PTdXrlbpz+mDcoJAyUycR9psQglGFPHWBTblXXnSpPPSvb+Q cGwnoseD+3Mzs3giuDoJ2W+MXtATASsSslWCh63p9Y0tOOkt+hhVZ3yp3Rl2MgUdEkp4ne A2fO8L4OClXQK7O5invadYncciTJvPTAiZlDJ4b5aBc= 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::29; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131821839158500 Content-Type: text/plain; charset="utf-8" From: Akshey Taneja WHvPartitionPropertyCodeX64MsrExitBitmap is not implemented on Windows 10 version 1809 and earlier, where WHvSetPartitionProperty() returns WHV_E_UNKNOWN_PROPERTY (0x80370302) and whpx_accel_init() aborts with -EINVAL. QEMU started requesting it in ba1bda25b7 ("whpx: i386: x2apic emul= ation"). Treating the failure as non-fatal is not sufficient on its own: whpx_default_props unconditionally enables x2apic, and x2APIC is reached through MSRs, so without MSR exits the userspace LAPIC never observes the guest's APIC accesses and the guest hangs immediately after the firmware hands over. Observed as a black screen with an Ubuntu 24.04 guest that otherwise boots in about 40 seconds. Record whether the MSR exit bitmap was accepted and, when it was not, apply x2apic=3Doff so the guest uses the MMIO based xAPIC, which is still intercepted normally. Reported-on: Windows 10 Enterprise LTSC 17763, Intel i7-6700 Signed-off-by: Akshey Taneja [Patch edited, version 1903 is the first release of Windows 10 with this AP= I] Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index f40409b330..7a41ab1542 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -57,6 +57,7 @@ #define HV_X64_MSR_GUEST_IDLE 0x400000f0 =20 static bool is_modern_os =3D true; +static bool whpx_msr_exits_available =3D true; =20 static const WHV_REGISTER_NAME whpx_register_names[] =3D { =20 @@ -3008,6 +3009,16 @@ static PropValue whpx_default_props[] =3D { { NULL, NULL }, }; =20 +/* + * x2APIC is reached through MSRs, so emulating it in userspace requires t= he + * MSR exit bitmap. Hosts without that property must fall back to xAPIC, + * which is MMIO based and therefore still intercepted. + */ +static PropValue whpx_no_msr_exit_props[] =3D { + { "x2apic", "off" }, + { NULL, NULL }, +}; + =20 void whpx_cpu_instance_init(CPUState *cs) { @@ -3015,7 +3026,8 @@ void whpx_cpu_instance_init(CPUState *cs) X86CPUClass *xcc =3D X86_CPU_GET_CLASS(cpu); =20 host_cpu_instance_init(cpu); - x86_cpu_apply_props(cpu, whpx_default_props); + x86_cpu_apply_props(cpu, whpx_msr_exits_available ? whpx_default_props + : whpx_no_msr_exit_p= rops); =20 if (xcc->max_features) { whpx_cpu_max_instance_init(cpu); @@ -3459,10 +3471,20 @@ int whpx_accel_init(AccelState *as, MachineState *m= s) WHvPartitionPropertyCodeX64MsrExitBitmap, &prop, sizeof(WHV_PARTITION_PROPERTY)); + /* + * Earlier Windows 10 releases not implement this property. + * It is implemented starting from Windows 10 version 1903 (18362). + */ if (FAILED(hr)) { - error_report("WHPX: Failed to set MSR exit bitmap, hr=3D%08lx", hr= ); - ret =3D -EINVAL; - goto error; + if (hr =3D=3D WHV_E_UNKNOWN_PROPERTY) { + whpx_msr_exits_available =3D false; + warn_report("WHPX: MSR exit bitmap unsupported on this Windows= " + "version, falling back to xAPIC"); + } else { + error_report("WHPX: Failed to set MSR exit bitmap, hr=3D%08lx"= , hr); + ret =3D -EINVAL; + goto error; + } } =20 hr =3D whp_dispatch.WHvSetPartitionProperty( --=20 2.54.0 (Apple Git-157) From nobody Mon Nov 23 04:34:07 2026 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1794131753; cv=none; d=zohomail.com; s=zohoarc; b=CW0m6wUpp2eMbvOMXAp/aMTiSevAmyVu4jD2sgN8IWyvQgZW4YYsF/Ayr7bX16sY7W9pOF8WGzn0rTG8v9e17fTJGnqxX7FsOj+hqmsIf1LnlMwPS9dmIxbZH+CIQpSNhC+iGpX+0aKOfTvx0KkPrCH07nOmMqCQNmrknREL6Po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794131753; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HQf0TzrDLzAsn93+AHhIDicyMKzXLCj79qsA4L0ue0k=; b=WgSwjcauWb9WkC6mL1h9t//smbnJeFIOMPiQodhUx6qTPxC2L68tB38LbfDHacrV24QYEZIZJvaKW47GWzsMlsCwsBRrNLNHXYfOH0bJRn9a0Wg/PmOvStoynHriO0Ll77gifF20ZXUlouQhJmjJ7rB4zBhHrDQODi8cPqOxrnk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794131753726680.7048114761496; Sun, 8 Nov 2026 01:55:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xPzbm-0005XN-8r; Sun, 08 Nov 2026 04:54:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbS-0005TW-2V for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:22 -0500 Received: from st-2004h-snip6-7.eps.apple.com ([2a01:b747:3001:201::4e] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xPzbQ-00061K-G2 for qemu-devel@nongnu.org; Sun, 08 Nov 2026 04:54:21 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPS id 3F6C918001A4; Sun, 08 Nov 2026 09:54:18 +0000 (UTC) Received: from localhost.localdomain (unknown [17.156.216.30]) by p00-icloudmta-asmtp-us-east-1a-100-percent-1 (Postfix) with ESMTPSA id 0960B18000CB; Sun, 08 Nov 2026 09:54:16 +0000 (UTC) X-ICL-RepId: 01a1ba94-85bd-7951-9aa7-6b18ccb1ade4 X-ICL-Out-Info: HUtFAUMEWwJACUgATUQeDx5WFlZNRAJCTQtIBUMGWgReC0wHQwJZEhVdRV4CXwpfFV04RgNHGVcUUBtHDFUHV15fChMLU1ZHHkkKVgleCEYRWxRWQ1EZEgJaRQVNXw5eHwQXRhlVBEceXVZAGRkCURxWDVdDVARfUEkMQVBsWgBHF0gdXRlZb1BdHA4YWRtAFV0RUBlWCV4VFx5BTVoCVk0FSgNfAVoDQAFIClgDWwFeDkgLXARGA0QUFVwFVgZXFHkNXR1FDlYZWgxSD1sOHBZLRhMZThtXTVoNQBlYBm0UVhVSBFk= Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1794131659; x=1825667659; bh=HQf0TzrDLzAsn93+AHhIDicyMKzXLCj79qsA4L0ue0k=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=cPpajoO/FHe658PfCTtTS8dM7VWGXtYeuKfXezmnWJQIDJL3WmF07X/IL5D5+wG2FJOGlVSSSXclS54H5Ck0VP6haoaJiaCS+tnn5DgvRkChiOexDxJ3j3LYMiKC3OeufhDNx3OKV97N4Ec10jBefbPNZptNTcoLoa2SNuy4AKvaGBPTZ7HyJpRCE9D77W9uQ1RYkgbfXn5tsD6VzicHxrF7fZm0+cRezkSQHT6ipOcLJRUszTZ3/fSbKthvbwK4e0YUD0eThIkfRrhSH24EUJTVmPvwyJhLUrsJKQn3sYQex6jFJtSaeQi8H3xIYW1hQPEPr7+3NLGzR4wrsM0CPw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Pedro Barbuda , Peter Maydell , Pierrick Bouvier Subject: [PULL 13/13] whpx: i386: also save debug registers Date: Sun, 8 Nov 2026 02:54:03 -0700 Message-ID: <20261108095403.70813-14-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr> References: <20261108095403.70813-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: fIZig3DwwmqliSiQWWPblc25xJa-3Yvo X-Authority-Info-Out: v=2.4 cv=IaKKmGqa c=1 sm=1 tr=0 ts=6af046ca cx=c_apl:c_pps:t_out a=oyWFxbOnq+dmhQrAPgaJYA==:117 a=oyWFxbOnq+dmhQrAPgaJYA==:17 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=3nrfYwkK1g5-NatN6WYA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA4MDAzOSBTYWx0ZWRfX6KZsA7fG9ffl 3WyGyG3I6GF4pRRsMurWPhewufLvgkXEnKNz4hc0FHc2e7OMUhXuc+ypLn5x2fY++NaTcVY+swf PwbgmUiCsQC1+bfLtVGk/sFkuK3bEXJd6f7Z0qql/0iAso1e+417lO2GOt8T7NLkAOL+QGEHcyU NXh4iw/pyl0Ck8KUBDTVEW9ppYGzNLFamQp/XWf/SFgDLe9kfVTA/YtyMK9ws66QW1eKz9SU3R7 p2m94rOBd5jVr6YMrYa11xQ85OHU9oTBMfQ419O/PDhFFdXSVoA3iqH7V88V3XBG4DgOd4JbfQ7 ZMG8wSRPHHSupLAk42yqKh57VwrydUmhpnq06Y93WDGNWza4p5rxxByW5R4I5o= X-Proofpoint-GUID: fIZig3DwwmqliSiQWWPblc25xJa-3Yvo X-JNJ: AAAAAAABoR+c4vsn8j3DnTxz3hrkr+809dv1V/DcsrICZCQP6VkPmix9BtpFYqxQG75jCH vKHyypYumqXBrk4vpZ5N37bKFhmBBmsEA01AIatI70qjXNLdKXIwb7XanST8h/sU73/kA1 GgFuxP7yesRxlHSLhHphJ2eJCLlVuTnqqa5lJCml9IpYpLV2Q/a1xhs+mHgnGZ7XFm9K/H 4R76dTH+CWVWxMStwwL7g4qrYEW/K/1Cy+Vy9VwItgLib8WFM5rhZrDqw1lkOdBDYtD4h6 /D+IAMbI1Dx9Tkmp3ZBa5qjcBeRDL4/sMQir9x+n9PHiw1IL5KAImrLnULZaCJ4Qwqb+nT 5DIToPFtQrb4OIZVV/d+ANPLyr2SBWwuoHDX5nVZ7CWeY61ci9UXkFmX+TfQIrraXj7w+M aHnM1hwiWHnEi7JsuuBFnX1AO80f6E6VJBM4p333bD5d6FkZLAmv56I/jxrhTG+tbo4dUm 6r/1pjJ0Bg+eX2yaL5cBGgLnF6iUF6eSMb2XWxr/Pk6k6trfOGm7fhklYPZCAfb8FGO1Ol cqvv60mukx6mpJgcajNqUaGRxtE6wPxfq+v5vvk9q9nS93hYBVm3mM7GnBmFuzaEMkzNCB Egcjs1bgDmXHsCcJxeE60ufXl5urd6tQvKhwQJOEFATzUn6nApD5osBjz3zVPRFc3i7nvJ ypyUHZwCiBBCpPXRd9d+5tFJcioFaq+B67tMWa/yGziNDA4f2bv3M1C2dbasXV479ZtbIY CIhTr8JiHh77NAvyvDrlsY0SO1F5enOKHc/sdz+wUwl6Q0Wpd3Y1ENr41bn5lsIcDgZU7Q 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a01:b747:3001:201::4e; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1794131755116158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 43 +++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 7a41ab1542..4bde9724c6 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -101,16 +101,6 @@ static const WHV_REGISTER_NAME whpx_register_names[] = =3D { WHvX64RegisterCr3, WHvX64RegisterCr4, =20 - /* X64 Debug Registers */ - /* - * WHvX64RegisterDr0, - * WHvX64RegisterDr1, - * WHvX64RegisterDr2, - * WHvX64RegisterDr3, - * WHvX64RegisterDr6, - * WHvX64RegisterDr7, - */ - /* X64 MSRs */ WHvX64RegisterEfer, #ifdef TARGET_X86_64 @@ -126,7 +116,12 @@ static const WHV_REGISTER_NAME whpx_register_names[] = =3D { WHvX64RegisterCstar, WHvX64RegisterSfmask, #endif - + WHvX64RegisterDr0, + WHvX64RegisterDr1, + WHvX64RegisterDr2, + WHvX64RegisterDr3, + WHvX64RegisterDr6, + WHvX64RegisterDr7 /* Interrupt / Event Registers */ /* * WHvRegisterPendingInterruption, @@ -686,6 +681,19 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel = level) vcxt.values[idx++].Reg64 =3D env->fmask; #endif =20 + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr0); + vcxt.values[idx++].Reg64 =3D env->dr[0]; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr1); + vcxt.values[idx++].Reg64 =3D env->dr[1]; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr2); + vcxt.values[idx++].Reg64 =3D env->dr[2]; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr3); + vcxt.values[idx++].Reg64 =3D env->dr[3]; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr6); + vcxt.values[idx++].Reg64 =3D env->dr[6]; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr7); + vcxt.values[idx++].Reg64 =3D env->dr[7]; + /* Interrupt / Event Registers - Skipped */ =20 assert(idx =3D=3D RTL_NUMBER_OF(whpx_register_names)); @@ -1070,6 +1078,19 @@ void whpx_get_registers(CPUState *cpu, WHPXStateLeve= l level) env->fmask =3D vcxt.values[idx++].Reg64; #endif =20 + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr0); + env->dr[0] =3D vcxt.values[idx++].Reg64; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr1); + env->dr[1] =3D vcxt.values[idx++].Reg64; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr2); + env->dr[2] =3D vcxt.values[idx++].Reg64; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr3); + env->dr[3] =3D vcxt.values[idx++].Reg64; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr6); + env->dr[6] =3D vcxt.values[idx++].Reg64; + assert(whpx_register_names[idx] =3D=3D WHvX64RegisterDr7); + env->dr[7] =3D vcxt.values[idx++].Reg64; + /* Interrupt / Event Registers - Skipped */ =20 assert(idx =3D=3D RTL_NUMBER_OF(whpx_register_names)); --=20 2.54.0 (Apple Git-157)