From nobody Thu Apr 30 00:40:44 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=1776191003; cv=none; d=zohomail.com; s=zohoarc; b=DCB12ubytII8C6tHhQDCRbN5Uh6G7b7YRLR2U+l05MSDgnXeH71vBy6OeihZqRT6a3LhREYCrJBHEMr107LlQMm4YVHpaz3SbfgM7QOODltUTY2UlVnIAZBP8tWhwT71nEkdQnHY0O1X60YW8kpTgpy009S2I4RcibuDQUL2OIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776191003; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aiXyhBzTJzaIzKx5bXgk3uW8CyShOVzrypP76mpg4o8=; b=P7OqlnPPdY3oNDoCMj8I+k9SqlWmjnMj9lt0erHYeg1JTSUq2nQ5SQ7EIfgWm6+68yAwwuwmmPEOeds7rxImoObcKe4VYLMFlkp7pHDmNEFvc1Rt5R3EFgd7vOIx+ifIdwytdm2dnXtJqy1Riec7x8oMlv+C/po5hIpRhFRvJ50= 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 1776191003272106.19627982327313; Tue, 14 Apr 2026 11:23:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPS-00066B-5a; Tue, 14 Apr 2026 14:22:51 -0400 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 1wCiPN-00065a-Gy for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:45 -0400 Received: from pv-2005b-snip4-11.eps.apple.com ([57.103.66.191] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPL-0006TH-SP for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:45 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id 795EA180139C; Tue, 14 Apr 2026 18:22:38 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id BD0D71801380; Tue, 14 Apr 2026 18:22:36 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190959; x=1778782959; bh=aiXyhBzTJzaIzKx5bXgk3uW8CyShOVzrypP76mpg4o8=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=UNvrRU1qK4SkW1Kel/MAY56l1X/8xo6bTGeo+jhBaFCaEGxwb3u/Bru5c3/WwHI18HUo9E1SNCdi5r8nPxOb3BRlN+Hh3fS5xOWJ5QINT8DmfXxww8hNbnh8g/j1KSYV9NkUxdgxkpkLNEoRfrYyETtnYs9f48Jgce+51rrpZzxCN3c5xRQXISknerPejO0l/WzeJNZVkrwQSIAmwnyIsP1qyddxXfa+OhF/dKGXeOzHkHKYTggJutQ062aDMQL84kiieH9QxLJjtaKI8KvNiJmSzaGujX98o5L+XXKwuV55B1vTCDrioRjsPQ/hEBdvufQoJt0dBK9Z+8u8D+6seA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 1/7] whpx: i386: set apicbase value only on success Date: Tue, 14 Apr 2026 20:22:25 +0200 Message-ID: <20260414182231.18776-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=DIKCIiNb c=1 sm=1 tr=0 ts=69de85ef cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=uh2sygq7LFHjsVUyvz4A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MiBTYWx0ZWRfX5jZ6xpIQGErE T2WslOwqraU4WB5+r/1DQbjqm4OLPHMGcipp0OBQVIyP8hLjj1DsLkyvx3niO+cwPUw9SQflbOB WXzzTg/3EnTmrgWhS8r8RKdNKVOLQk1Rw46z4coGO1RBR5Wmu3VQmz6+k+qtjfeZ9IlKGnKC0cs gx0dao3EwfWvMie77WUapP4V+lxH8NowR2gHkjbvyoVxrjj6283gk+uQBcyOG3YMY9o4wmS3vbq 7AmBasyJFZyLqB57ugtIW8o0XCfp2ZJiljWHzFcbygoo1bqTtBYmlA4V7AXMkErW8p1UIt5nN/z hqBiylIKkcvzeD2nHpB+kMgX5oEw5rzbcwWsdaUokHTQS6gI1a7FhMftGFThUs= X-Proofpoint-GUID: ly-SOi5QhLpTXdXF3ZY4qKL9M1oaVSvN X-Proofpoint-ORIG-GUID: ly-SOi5QhLpTXdXF3ZY4qKL9M1oaVSvN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 adultscore=0 mlxlogscore=655 lowpriorityscore=0 mlxscore=0 phishscore=0 clxscore=1030 suspectscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140172 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=57.103.66.191; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1776191006903154100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 86d2dc1df8..56a789c5fd 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2001,8 +2001,9 @@ int whpx_vcpu_run(CPUState *cpu) int msr_ret =3D cpu_set_apic_base(X86_CPU(cpu)->apic_s= tate, val); if (msr_ret < 0) { x86_emul_raise_exception(&X86_CPU(cpu)->env, EXCP0= D_GPF, 0); + } else { + whpx_set_reg(cpu, WHvX64RegisterApicBase, reg); } - whpx_set_reg(cpu, WHvX64RegisterApicBase, reg); } } =20 --=20 2.50.1 (Apple Git-155) From nobody Thu Apr 30 00:40:44 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=1776191072; cv=none; d=zohomail.com; s=zohoarc; b=JGhwgLPzWjBBaF6zoPV4NIXfebaqnSkvrsNqjEgDFM+DowXEfzU2xG0DwkAYE5r1OHSPr6TAY02X13LQSobZ6bs4/xSzapGjhbv7S09ARIf8H4u26BBq6sHDo95HE1WjXgB+NUj8QjInLyWKRr+zrtSeJLVb54lGkVkukoszqno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776191072; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H55iPnzts7qCVmoBJ9TP4r+Lt8OW7TgpBaoEUQHYL2o=; b=cbyN0wkdsdgqGM0AG48f46eVELjCW7wFhpj4ZrULAxlDbeenLUViltC25UG3mgAozfn8Tpfc+/djdyN6xIrIRo0klf7ntjp6Kx958nMmWGgBofw2U+pjyfNUKCpXYGZf8LQHCA65pDVgE9lHrjE9f5U5zPdWPyQkh4WQI0DuTBw= 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 1776191072449130.91901860183896; Tue, 14 Apr 2026 11:24:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPj-0006BR-7j; Tue, 14 Apr 2026 14:23:07 -0400 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 1wCiPN-00065p-PP for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:45 -0400 Received: from pv-2005i-snip4-10.eps.apple.com ([57.103.66.200] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPL-0006TX-H2 for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:45 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id 309CF18000A5; Tue, 14 Apr 2026 18:22:39 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id 3AEC218001F3; Tue, 14 Apr 2026 18:22:38 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190962; x=1778782962; bh=H55iPnzts7qCVmoBJ9TP4r+Lt8OW7TgpBaoEUQHYL2o=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=VrykrCOB9H7MgObmRL9mUlzJN7CzWedoV1snUy1feQosOjODOINnHqTqAovPzLhfsDxBrqlfkAotT6G5yZEPc6zaTkQ2jY178Heb8RceEM4Y+8xnKLhL9g7COsccBw3QauJjRC2fWsXitW9u2JXwGkHMAeZYWNDHqK1r9hzNwzIAy75m/t3GZSiK1TSkWTV1pnK5+xD3vOkVXmYH+FO345HKn8B4244fJWfbBDNJdg4nsuzgdDVenCNINUkT9v3hHTuMR5SE+GKGbFDotIt8ZbYBahqUCIJyAlUVy7vNu1eLaJoX0KHe9LtLk/+bR/JovZxknBmBL4gGee1Twz3Eyw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 2/7] whpx: i386: unknown MSR configurability Date: Tue, 14 Apr 2026 20:22:26 +0200 Message-ID: <20260414182231.18776-3-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=eurSD4pX c=1 sm=1 tr=0 ts=69de85f1 cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=9z_AL-2ZILZrMqfKHsQA:9 X-Proofpoint-GUID: VmnGIc_BjCs2wDpOi-EmYpdF8eXejgal X-Proofpoint-ORIG-GUID: VmnGIc_BjCs2wDpOi-EmYpdF8eXejgal X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MiBTYWx0ZWRfX0gJf44td70Jx TPVztUtOgVvADpr6L1wyoS41lNj5XaqlRZGjKciqR01Ba7UIYGPtmqEOzXPpxy4+9xUB1UiMUET ldvWUfXEi4MIjcd8FItK2kwit4o4/FIKTLk34x5ZZNj0mWFROz1RJz5qWVsZeslXOm6rlMnNcrF 2popnsjpvPtpUtwS30t3RikNfrcionnwKYoHM4PC5iOFUuleOiPL4gK6k/4n0lOOfKaIKl+7me7 XkrTilOPlwQwmNzZQi05KIFF5oLalWIe2eZebiWVeP3RlcLynTkwkY2zysUb9mQtK/OCUF7uo1H N8gHH9leih0PcQ0scrVr2O9/NY74xQDON9OmqUfVbMOeBuU8HEv2XFiSM9BaQw= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 clxscore=1030 spamscore=0 malwarescore=0 phishscore=0 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140172 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=57.103.66.200; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1776191073914158500 Content-Type: text/plain; charset="utf-8" Add an option to inject back a GPF for unknown MSRs. Keep it on by default for now as Linux expects accesses to some AMD-specific MSRs to always succeed when on an AMD host. Signed-off-by: Mohamed Mediouni --- accel/whpx/whpx-common.c | 38 ++++++++++++++++++++++++++++++++++ include/system/whpx-internal.h | 1 + target/i386/whpx/whpx-all.c | 4 ++++ 3 files changed, 43 insertions(+) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 59be996aef..706871f138 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -505,6 +505,38 @@ static void whpx_set_hyperv(Object *obj, Visitor *v, } } =20 +static void whpx_set_unknown_msr(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + struct whpx_state *whpx =3D &whpx_global; + OnOffAuto mode; + + if (!visit_type_OnOffAuto(v, name, &mode, errp)) { + return; + } + + switch (mode) { + case ON_OFF_AUTO_ON: + whpx->ignore_unknown_msr =3D true; + break; + + case ON_OFF_AUTO_OFF: + whpx->ignore_unknown_msr =3D false; + break; + + case ON_OFF_AUTO_AUTO: + whpx->ignore_unknown_msr =3D true; + break; + default: + /* + * The value was checked in visit_type_OnOffAuto() above. If + * we get here, then something is wrong in QEMU. + */ + abort(); + } +} + static void whpx_cpu_accel_class_init(ObjectClass *oc, const void *data) { AccelCPUClass *acc =3D ACCEL_CPU_CLASS(oc); @@ -538,6 +570,11 @@ static void whpx_accel_class_init(ObjectClass *oc, con= st void *data) NULL, NULL); object_class_property_set_description(oc, "hyperv", "Configure Hyper-V enlightenments"); + object_class_property_add(oc, "ignore-unknown-msr", "OnOffAuto", + NULL, whpx_set_unknown_msr, + NULL, NULL); + object_class_property_set_description(oc, "ignore-unknown-msr", + "Configure unknown MSR behavior"); } =20 static void whpx_accel_instance_init(Object *obj) @@ -552,6 +589,7 @@ static void whpx_accel_instance_init(Object *obj) whpx->hyperv_enlightenments_required =3D false; /* Value determined at whpx_accel_init */ whpx->hyperv_enlightenments_enabled =3D false; + whpx->ignore_unknown_msr =3D true; } =20 static const TypeInfo whpx_accel_type =3D { diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index cf782cf5f8..86639627b3 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -47,6 +47,7 @@ struct whpx_state { bool hyperv_enlightenments_required; bool hyperv_enlightenments_enabled; =20 + bool ignore_unknown_msr; }; =20 extern struct whpx_state whpx_global; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 56a789c5fd..b248afb5e7 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2048,6 +2048,10 @@ int whpx_vcpu_run(CPUState *cpu) vcpu->exit_ctx.MsrAccess.AccessInfo.IsWrite); } =20 + if (!is_known_msr && !whpx->ignore_unknown_msr) { + x86_emul_raise_exception(&X86_CPU(cpu)->env, EXCP0D_GPF, 0= ); + } + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( whpx->partition, cpu->cpu_index, --=20 2.50.1 (Apple Git-155) From nobody Thu Apr 30 00:40:44 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=1776191004; cv=none; d=zohomail.com; s=zohoarc; b=VQgxVl34wLYHRNxxN4fYi+VUez1+LCt6lIKi18n+7+zjUtdC/YbuTw00maEedEirv68XkKJufOG2RXldDp6h5WxLwB6EWo+72u/IXZFVabuNzRC0rleX4/88tOf45SZQxzBoNd+W43+GangMw9VFI7UsAYMxBgOAUZU+jGbWwf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776191004; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TrgeVsVYtEOZKp22T3irnEElZdL3/X6V7jZ6IikmDcQ=; b=RRCGT9Y6LjbclM+kFLWnkqyKglwPWRYg6IaNmrpk7oXJQKYJYqdA/qG1zKhjhVanF4hlJDwypg2Bei2/YW7InQDFRSeXYZFXOJcXLDmVi6+wZNhc7Mps6Uo2iaAPxFEIja8uvA682/pvLjPGoa3asB7E3YpVNS0nZxexvHpwvyU= 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 1776191003992177.8661140394314; Tue, 14 Apr 2026 11:23:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPS-00066A-53; Tue, 14 Apr 2026 14:22:51 -0400 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 1wCiPN-00065b-JZ for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:45 -0400 Received: from pv-2005k-snip4-11.eps.apple.com ([57.103.66.221] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPL-0006TW-Rr for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:45 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id 3A6D51801395; Tue, 14 Apr 2026 18:22:41 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id A362818001C3; Tue, 14 Apr 2026 18:22:39 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190962; x=1778782962; bh=TrgeVsVYtEOZKp22T3irnEElZdL3/X6V7jZ6IikmDcQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=CJyJmSaPUlJp92/UjYqOW8jNjS2Pj29P1w574OezBYO5ogNymydCnKq/VpAia47Pf4KTyngKW6hMOGm7jb30rx87uXw0C89uHxYNsdsOQA/txWfWMbXPvuUjAQ00eTgWf1o3NzQATmACw91NqItA0nQsTAM1yL29JMW1lNZU2IfO2SGD++ieQtmh3XXjyQF7i6nECAjJMoDYzwErGeQsGewFwsOjzeSo/NyX+JyyD+pjbRgj+JmLhOFQl8/Y6S70vkF64K9faLN+YXeHOPhHn+2So9RaIEt2jdPjcAf+fR8VeidvKA3msQ2wQZuE83kcAolscPX/42YIDe6okAYK+Q== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 3/7] whpx: i386: enable GuestIdleReg enlightenment Date: Tue, 14 Apr 2026 20:22:27 +0200 Message-ID: <20260414182231.18776-4-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=fuHRpV4f c=1 sm=1 tr=0 ts=69de85f1 cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=givlr1pFTcEyfNb0yRoA:9 X-Proofpoint-ORIG-GUID: o545O07QWpGgSZKPb89EBGZ8Bqhbk7hy X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MiBTYWx0ZWRfX4gSxP4+lDtIg HmkwPj58ySTUZrImS18YtjFFFPX1zwNrVOFQ+7AD7FMIsaqTDGxSVhQQgDouyQ98XAZXWRj0IAk M38BNvutrqKofPRFDbXAJIpHu6aeGb6J5IPpacowS3WzTT3tUfiXyavW4qEaj6E4GsL/D8Q8xTn FBGUGS4rlSqHD11zowd6m6bjZWSMP+QP+iPH1uZcfxQuot5eZF14Bdu+HYk51oLd4q0fjNYP025 iJOAcj1qUGzR+jUoCiFHVywkDBupmovuFhrrREJeCJnCzoYxuDLr4lQ34XGaVBS57DbLged75Ho U33l04utWlxz7apeLEiH//zjX0dpVlc3sWwTBH0Aede2XlOBCsMZfl9KyPXmv0= X-Proofpoint-GUID: o545O07QWpGgSZKPb89EBGZ8Bqhbk7hy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=957 malwarescore=0 bulkscore=0 clxscore=1030 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140172 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=57.103.66.221; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1776191007992158500 Content-Type: text/plain; charset="utf-8" This corresponds to HV_X64_MSR_GUEST_IDLE (0x400000f0). This enlightenment is only available by the HV when using the Hyper-V LAPIC. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index b248afb5e7..73066581d4 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2686,6 +2686,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms) synthetic_features.Bank0.AccessIntrCtrlRegs =3D 1; synthetic_features.Bank0.SyntheticClusterIpi =3D 1; synthetic_features.Bank0.DirectSyntheticTimers =3D 1; + synthetic_features.Bank0.AccessGuestIdleReg =3D 1; /* * These technically work without the Hyper-V LAPIC * but behave oddly for multi-core VMs. --=20 2.50.1 (Apple Git-155) From nobody Thu Apr 30 00:40:44 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=1776191004; cv=none; d=zohomail.com; s=zohoarc; b=WW+US7n0cnN1dR/xZn90C7OH5FSOboTV1ENcVsrOSYFwlb2PkJHh6T7sCQSvt+PPnt/SjCHrYHMBIuRQD4e7PQIuf7kd+zP8318GwurvVBiJawnDVC3ET56wM1kmzIQRazoORzTpTiD2fvG5hWGMhapNX3/UJL7DobmYjIS2vok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776191004; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Yl0JdZN7K1dS8wO/C1JQWlTRVuBjUIl21ZEIdD6QW+U=; b=gH7k2pGJtYnBac7biaqlZWSplr0GXxvCOXAQO4XBvKAcXLWYLN7/exDdaUOQuUm5LvUF6QTt2CqaBiCCD1GP7G9mYYK/5P8FH/B+eaF+/GLtxWeWlQSiqc9wBFj/pE8ksWzZkKHr8qHH4+jPgD2YFfKGS6pPVtn27J9bqR7bcU8= 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 1776191004049491.5225215613175; Tue, 14 Apr 2026 11:23:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPY-00068r-5s; Tue, 14 Apr 2026 14:22:56 -0400 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 1wCiPP-00066G-Q5 for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:48 -0400 Received: from pv-2005d-snip4-10.eps.apple.com ([57.103.66.170] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPO-0006Ty-DD for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:47 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id EFEB1180178C; Tue, 14 Apr 2026 18:22:42 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id 1636E1800C8F; Tue, 14 Apr 2026 18:22:40 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190965; x=1778782965; bh=Yl0JdZN7K1dS8wO/C1JQWlTRVuBjUIl21ZEIdD6QW+U=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=S3JlQNt1J9S2fOdlLl1iuAKsTglBrP6QjMKa2JE0G87hy5Me7xMb1YaAJeCXENwqhlbNCDvIBqxV92pEKGW+q3R152zl72pk23c8Gx82cHXUX6bMQ5f+zExpUEd+La1SEcFhlS3ZWZRUOvkxN5t1rk+YYfaLNK2k4swBUTFpKOvzPc6570ueH69NdjPWYp3knYSpXmQkf8XMKNR5BwtTKvdos0F4Y2FyR4ju7dAHAX0OF+x27iblqadN0nETjmvf+MbL5IAVj79OTwqT9LVYBg8pjfXJ2SE8s85GXWc9EwOUl8MKLfypodFhf40gWs4JPYrHVINITI4jFdbnLPjO2A== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 4/7] whpx: i386: tighten APIC base validity check Date: Tue, 14 Apr 2026 20:22:28 +0200 Message-ID: <20260414182231.18776-5-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=MLJtWcZl c=1 sm=1 tr=0 ts=69de85f3 cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=uh2sygq7LFHjsVUyvz4A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MiBTYWx0ZWRfXwMsVyrKu4tqP qf0ElzzvpAX6vh1vfsBdPuRtZmUoiWx3aiZ9OvDuXIu4VCSZnSU8HB2/zbbWP4KlYFSCeBYfJYV HURLJQzfPlPQMvGgZWd1T/c9IIqWkwPBfLV4ukj55dX0TZyneNgDFGj8ns4F9m+tS6CHVEwcQYD 3diF9TZDsmS6Yr5n4Cv7wjrxIsxwUufcbtHIwFGLAgDqTo01XAbtaAXTQaLH/EkAlSfmU1aOvaN LsBuoiSAlCYMzPfnWuoWx0zvKT1PYwB779ZxIem/2x3XfNWFSKmoZqmhhQMrbULvwHKXTzV341j 6c5WrMzPz++d7O4ion3oL0hvZ5F94k6wpC5b/iJc40cNs/jobCgmuf7MDfaHrc= X-Proofpoint-GUID: lPMCG5uEgHaCkl_dxutepya9zpoL8ots X-Proofpoint-ORIG-GUID: lPMCG5uEgHaCkl_dxutepya9zpoL8ots X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=662 clxscore=1030 bulkscore=0 phishscore=0 spamscore=0 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140172 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=57.103.66.170; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1776191008125158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 73066581d4..6c39168b06 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1993,6 +1993,9 @@ int whpx_vcpu_run(CPUState *cpu) =20 if (vcpu->exit_ctx.MsrAccess.MsrNumber =3D=3D MSR_IA32_APICBAS= E) { is_known_msr =3D 1; + if (val & MSR_IA32_APICBASE_RESERVED) { + x86_emul_raise_exception(&X86_CPU(cpu)->env, EXCP0D_GP= F, 0); + } if (!vcpu->exit_ctx.MsrAccess.AccessInfo.IsWrite) { /* Read path unreachable on Hyper-V */ abort(); --=20 2.50.1 (Apple Git-155) From nobody Thu Apr 30 00:40:44 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=1776191095; cv=none; d=zohomail.com; s=zohoarc; b=cMUuk5q2a+1GWX4eF19DA9VYK4Zgvw1CRqWRX8EPH4lyFKe+VdQaO/myjRI10o7EigcrzYlBqqy0z2znfBEYzQDl4I16VW7WQ4WgplkTdiE821wKrrX28kdzOnHjNLC/mJZ9d2EG3DJMJjz9bEMiD0ifyr7ahYX3n4RhnqSEMos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776191095; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aHWbpBbWHa1pDSLj1H1tPnDt0duRVaN6KSal90efVe4=; b=AZkw9LzpqyEUa95zvLGQYM8xGEQ2N/OWBdM9NO8gbK3AbWCjpfanlx1sUVQR/1yKKkZWp9CoUsvTrMRr1bCzdUwLGQ6jZbzLPgiECjjC6X9RdjeI32XEpsN+u2sM5q638QqKyJINrJdYPWga6t/LZTyEeb0vZ6hU2Lp63MFVrWc= 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 1776191094667605.8454797493739; Tue, 14 Apr 2026 11:24:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPh-00069H-3s; Tue, 14 Apr 2026 14:23:05 -0400 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 1wCiPR-00066X-CG for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:50 -0400 Received: from pv-2005c-snip4-8.eps.apple.com ([57.103.66.159] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPP-0006UV-SF for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:49 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id 7A36618017A2; Tue, 14 Apr 2026 18:22:44 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id 8A90018001DB; Tue, 14 Apr 2026 18:22:42 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190966; x=1778782966; bh=aHWbpBbWHa1pDSLj1H1tPnDt0duRVaN6KSal90efVe4=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=Qb6rj1lBiQ/fdp5uLcQDat9lsIv+cNCd87KS0lhUkjC+XKe1dnpYA5WjxmxhwhQBGCH5lwonCc0GcXx5z5Dhgm1mfBWExY8HeGo+BVSE6Fpf2eHoCuevcXQPChWeCtUDIpM7sHbdHh+mqUVKBaO0VIyOAUZq56zvsu01PGmJcZBmZ4PzFhupx923bkptehA8DngYBS71BV6jBITQZ7otrerF+GFhnruSkOIfaX+1uHYYFkOSbhb4fajCK2bBupxf8QGaSvOfDPxkMJMldI3tnjY+I07jt0LhLAucamWdFphtQarWgBkOXxabNF4QjT8D14xDPn1+PF4OxW0ovlqLsg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 5/7] whpx: i386: ignore vpassist when kernel-irqchip=off Date: Tue, 14 Apr 2026 20:22:29 +0200 Message-ID: <20260414182231.18776-6-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=c4GmgB9l c=1 sm=1 tr=0 ts=69de85f5 cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=HmN67jXOOwgiugJlUbgA:9 X-Proofpoint-GUID: QPG1F_s5cYYfRUAsDQuBJrokPb-16-MJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MiBTYWx0ZWRfX6kukinN5p/0H x3+9bBgOCuEvOQnUVQgu1MZ7OiS5dCwJUH7SjZ1hcjLctr8ihGMWa645Eok+zNDSAIga8uUKM6X U4MXogQDE2vm0qdJRtHndeAUGqQQ3ROyDmzJCqEvGm7o/8KvmP+QMuBJyOOvYb2YwNKnGALgSxA aoWN/wW+SRiAi22OgO54VBq6nQIznWXmdYCG3/zS894ARqPPi695uSNuxqsXydGRszo/vxI/Rpn Nv4pBdhLIXDPPyDOszszaj8unY91AylFxu0sHl/nv39pzcBJ+2tvKIO2McJBhc4MWOsOrsErTX+ FvO4O6i7ABUPi7xtnALasZwh+0FNE9GDjImu8olFi9MGx97Oauf6l0mPYpC2VQ= X-Proofpoint-ORIG-GUID: QPG1F_s5cYYfRUAsDQuBJrokPb-16-MJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 clxscore=1030 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140172 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=57.103.66.159; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1776191095988158500 Content-Type: text/plain; charset="utf-8" Linux tries to set vpassist even when none of the enlightenments using it are available. So ignore the page it sets. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 6c39168b06..2e6679f40b 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -51,6 +51,7 @@ #define HYPERV_APIC_BUS_FREQUENCY (200000000ULL) /* for kernel-irqchip=3Doff */ #define HV_X64_MSR_APIC_FREQUENCY 0x40000023 +#define HV_X64_MSR_VP_ASSIST_PAGE 0x40000073 =20 static bool is_modern_os =3D true; =20 @@ -2033,6 +2034,18 @@ int whpx_vcpu_run(CPUState *cpu) } } } + + /* + * Linux tries to use it anyway even when not exposed.=20 + * Ignore the write as the VP assist page is not used. + */ + if (vcpu->exit_ctx.MsrAccess.MsrNumber =3D=3D HV_X64_MSR_VP_AS= SIST_PAGE + && vcpu->exit_ctx.MsrAccess.AccessInfo.IsWrite + && !whpx_irqchip_in_kernel() + && whpx->hyperv_enlightenments_enabled) { + is_known_msr =3D 1; + } + /* * For all unsupported MSR access we: * ignore writes --=20 2.50.1 (Apple Git-155) From nobody Thu Apr 30 00:40:44 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=1776191073; cv=none; d=zohomail.com; s=zohoarc; b=EWy6VQJuO30bmqYiz62sldRz1ejAFvS2aMgq44jsyYaq8avFRXy5sj52VLc3AELrCPUK+URqJK2eaorl9mJpw7X5MTFEksSE0B5q/zMhKJpNYDs8GYAm7If147XXRX2N8GtA+5k57tvoEMgxxLLEyUOtA2b14UdZQ7PI4OsiBWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776191073; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tT4F++bSuONbY+c7bgtCCb6QKbPZ19v7x1ehrozqyHo=; b=i/EYP2gtTRxQonIZU2RBDsSV0zQ5KDoZ5WIKoNOd0DGDAMO16vYeK0OG5wwR33tMi5lzdyUB9j7NMlNpMDRjF+oLvI4JWGMxPvGhl9CBRytc7KQWgeF5akU7oA3gzCktoTPVjseFxt5bVVSTz34rkeNyj9QnyTqcHE9jINntsVc= 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 1776191072803433.1091973628555; Tue, 14 Apr 2026 11:24:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPh-0006Ax-Kf; Tue, 14 Apr 2026 14:23:05 -0400 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 1wCiPS-00067S-Tj for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:51 -0400 Received: from pv-2005h-snip4-7.eps.apple.com ([57.103.66.248] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPQ-0006Ua-Dl for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:50 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id A3A2F1800108; Tue, 14 Apr 2026 18:22:45 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id F261618013AE; Tue, 14 Apr 2026 18:22:43 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190967; x=1778782967; bh=tT4F++bSuONbY+c7bgtCCb6QKbPZ19v7x1ehrozqyHo=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=fW6u+ORigS+O6Pk7YAhgz6rsavDy7P3hZ+z1TKixvAGV7T1UdxZuKauL1E9a3NfqjAFMgbGZHjHWpSTwr2fMcvRKWcfE8PJIHl8wwl1kHuiL1v2ImET/hXR8A1uABVoOvXZCL68eNvhPjuYq/++ukRyP3G+a16yzmJSEFsR446ajJYuF+/JGX1YffVPoi1S1SyUGMyqH5yIQlp0MGyXKL3c9Rgu9sNMO6Z8WCckbx27nXJMpmvHYhocIh6BEsUGll3lDAsFTRRZXzHuRJISB5DbCZJc1UVGAYqwkWA4XWOd0YOgUWTHU8ZeVzLHFqipeJQhK/h+XO2hhlXCbHWROhw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 6/7] target: i386: HLT type that ignores EFLAGS.IF Date: Tue, 14 Apr 2026 20:22:30 +0200 Message-ID: <20260414182231.18776-7-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MSBTYWx0ZWRfX5/ls1LiVJwEh 7F6c4jtssZKWOWA3UnyNXtmwc1ygtBe6nZaBjAOi2JwjYdZnWhVMok4FTUQ2AIRELYnDQDJtZju 3XtcioRKTyRnU2Ku9onGxf9zO5ss5E+YGB62m2W1OXZDAEGcHxN97syCHwnfJyWdyKGBSgARPCx aSOBRT/wtcyhAm2PPfN1m5FoWFBwNRWEIS1/EBCsPIqIC9K3o+IeKd3Xa8m41G1zhv8qeZSQRKd Tnr94MDHtHmog3n/bKp852mghUzmqARkuOBLaWmHKwMqbsthDjXn5RCwTSbIDcndnR//rnL0ig/ P06adoeVJhYi0nOSzFit1xeV6u7AHHq4ixA3LHjKiDC5YAfI2bDeXiwMOMAjsA= X-Authority-Info-Out: v=2.4 cv=KJ1XzVFo c=1 sm=1 tr=0 ts=69de85f6 cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=ZtXhj7NgbhMgH__AbsQA:9 X-Proofpoint-GUID: H12iFphNauZtdUD9oA64BRiLR7IOtK4E X-Proofpoint-ORIG-GUID: H12iFphNauZtdUD9oA64BRiLR7IOtK4E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1030 mlxlogscore=937 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140171 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=57.103.66.248; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1776191076745154100 Content-Type: text/plain; charset="utf-8" The TLFS says: > A partition which possesses the AccessGuestIdleMsr privilege may trigger > entry into the virtual processor idle sleep state through a read to the > hypervisor-defined MSR HV_X64_MSR_GUEST_IDLE. The virtual processor will > be woken when an interrupt arrives, regardless of whether the interrupt > is enabled on the virtual processor or not. Meanwhile, Windows 24H2+ calls this MSR anyway without the privilege being = set. Add the infrastructure to support it on the generic QEMU side. Signed-off-by: Mohamed Mediouni --- target/i386/cpu.c | 10 ++++++---- target/i386/cpu.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 0000093fa3..b18e40666e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10482,13 +10482,15 @@ int x86_cpu_pending_interrupt(CPUState *cs, int i= nterrupt_request) (((env->hflags2 & HF2_VINTR_MASK) && (env->hflags2 & HF2_HIF_MASK)) || (!(env->hflags2 & HF2_VINTR_MASK) && - (env->eflags & IF_MASK && - !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { + ((env->eflags & IF_MASK && + !(env->hflags & HF_INHIBIT_IRQ_MASK)) + || env->hflags2 & HF2_HYPERV_HLT_MASK)))) { return CPU_INTERRUPT_HARD; } else if (env->hflags2 & HF2_VGIF_MASK) { if((interrupt_request & CPU_INTERRUPT_VIRQ) && - (env->eflags & IF_MASK) && - !(env->hflags & HF_INHIBIT_IRQ_MASK)) { + ((env->eflags & IF_MASK && + !(env->hflags & HF_INHIBIT_IRQ_MASK)) + || env->hflags2 & HF2_HYPERV_HLT_MASK)) { return CPU_INTERRUPT_VIRQ; } } diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0b539155c4..67f508dc10 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -225,6 +225,7 @@ typedef enum X86Seg { #define HF2_NPT_SHIFT 6 /* Nested Paging enabled */ #define HF2_IGNNE_SHIFT 7 /* Ignore CR0.NE=3D0 */ #define HF2_VGIF_SHIFT 8 /* Can take VIRQ*/ +#define HF2_HYPERV_HLT_SHIFT 9 /* Hyper-V HV_X64_MSR_GUEST_IDLE */ =20 #define HF2_GIF_MASK (1 << HF2_GIF_SHIFT) #define HF2_HIF_MASK (1 << HF2_HIF_SHIFT) @@ -235,6 +236,7 @@ typedef enum X86Seg { #define HF2_NPT_MASK (1 << HF2_NPT_SHIFT) #define HF2_IGNNE_MASK (1 << HF2_IGNNE_SHIFT) #define HF2_VGIF_MASK (1 << HF2_VGIF_SHIFT) +#define HF2_HYPERV_HLT_MASK (1 << HF2_HYPERV_HLT_SHIFT) =20 #define CR0_PE_SHIFT 0 #define CR0_MP_SHIFT 1 --=20 2.50.1 (Apple Git-155) From nobody Thu Apr 30 00:40:44 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=1776191060; cv=none; d=zohomail.com; s=zohoarc; b=EZcpTAVtBoz2Z9+8+Vvd0FT0iZe5uujhnDJJ+EcN6cc8g7zB3vP9eJFXgGXQFWrz4fEamPWbT+GliFgiYp/85pT85F/eMyXaI58jnteyCHsbwSM60AcHKPUVQQ+q7RDHIbtzGjxv7rNyXQY/Sj/oq/vH0PhLuA0p8qqZbLJeUWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776191060; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6lVPI+m1fDykLwqr3FmC9utzBoApYycYAPsCsYijeBQ=; b=PGKpmskc0sDAgFv7cqV3boYQcZOJvTRF9Bsvr7x3VXsARRqinOE9//502AzDyvEQJTgirZnuY8T9fhn47Cj2eC8Ll0YMb2JKbnBwETRYAURJjT1gnc66K5nWUl7uIfKd3YNPZwg6Q5CXp9Azac45eOZMxs6phh9xOGlne4Ceu1g= 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 1776191060190579.1419771645914; Tue, 14 Apr 2026 11:24:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPa-000690-6f; Tue, 14 Apr 2026 14:23:00 -0400 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 1wCiPU-00068N-AV for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:52 -0400 Received: from pv-2005g-snip4-11.eps.apple.com ([57.103.66.241] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPS-0006Uw-5t for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:51 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id 1CEC01801395; Tue, 14 Apr 2026 18:22:46 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id 66EAB18001C2; Tue, 14 Apr 2026 18:22:45 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190968; x=1778782968; bh=6lVPI+m1fDykLwqr3FmC9utzBoApYycYAPsCsYijeBQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=JzfW61ZsLVqnaVpKRLOAkzyseZhn/VCpmqqOOGxiNQ0PvcrFWdEHv9Ey3kGonokeYsdMOJgJDJNhYZTN47yfLDhP7fUWiJgzgW+EXGbodqaTz7C6+mjafxGYZsNzzQK8StEnKGwm7GJVjL/SkYlHCD0U9V4/rSRmRBJBwwR/2iqMo6/q+urxkGwByKnbn5Y67/mwJ/4V5WVqzvr5tKqGMAXTIQdm/ZV03feRWmHXcbcfqe3kwbM6Ie3NGOSA7ZMXxIesm7T6I7BEWe/mlbjyHrg02Z+cvs2+SJJ5x9fwlNk8nwym33YDj4+tXBs5jeHYFF4xE126hmIDspYldScx5A== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 7/7] whpx: i386: add HV_X64_MSR_GUEST_IDLE when !kernel-irqchip Date: Tue, 14 Apr 2026 20:22:31 +0200 Message-ID: <20260414182231.18776-8-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=fuHRpV4f c=1 sm=1 tr=0 ts=69de85f7 cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=mSEN7FZ2dYRJNo9PPvgA:9 X-Proofpoint-ORIG-GUID: FxBd79eiJqztALedvUoGlk5Nlu3ocs-e X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MiBTYWx0ZWRfX6myu1tomdZox hTEYjNabLO/AZB6oGv2F77fR//h/dKHjywXHdbECxgqM23pSOZvjtSECRIwsHehiTaA9MMiV1GI po/VuD7HZrLkU+TL7cbXM8K02fSkw/kfijz0b8qv70FmCozrJ4OHEZwfEeuycsq4Sh+MbyaooY/ kd8Gi0v04LVR0suXIuYa/EgeZLkdtFdqvgEJKzeNVdzMH46DypAyH6lxMysgYV2Om6cA6/HsmP8 pTji8UmipfZLKnN7IRNIeyORuwMwKM3EZw1t04FC7UEOv1vx4ybpxONRRdex/bhIEtZUU71ZT2D PX2r8cKxlRj0SlZGdGwUU9hexc/hn6OIojgM0cV65GBQttbKhjgwEH4ILmS6wg= X-Proofpoint-GUID: FxBd79eiJqztALedvUoGlk5Nlu3ocs-e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 clxscore=1030 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140172 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=57.103.66.241; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1776191062710154100 Content-Type: text/plain; charset="utf-8" Add support for an oddball HV_X64_MSR_GUEST_IDLE not-quite-an-HLT that wakes the vCPU even if EFLAGS.IF is set. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 46 +++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 2e6679f40b..7a157e6dae 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -52,6 +52,7 @@ /* for kernel-irqchip=3Doff */ #define HV_X64_MSR_APIC_FREQUENCY 0x40000023 #define HV_X64_MSR_VP_ASSIST_PAGE 0x40000073 +#define HV_X64_MSR_GUEST_IDLE 0x400000f0 =20 static bool is_modern_os =3D true; =20 @@ -1543,13 +1544,16 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool e= xit_context_valid) } } =20 -static int whpx_handle_halt(CPUState *cpu) +static int whpx_handle_halt_generic(CPUState *cpu) { + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; + int ret =3D 0; =20 bql_lock(); if (!(cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD) && - (cpu_env(cpu)->eflags & IF_MASK)) && + ((cpu_env(cpu)->eflags & IF_MASK) || env->hflags2 & HF2_HYPERV_H= LT_MASK)) && !cpu_test_interrupt(cpu, CPU_INTERRUPT_NMI)) { cpu->exception_index =3D EXCP_HLT; cpu->halted =3D true; @@ -1560,6 +1564,27 @@ static int whpx_handle_halt(CPUState *cpu) return ret; } =20 +static int whpx_handle_halt(CPUState *cpu) +{ + int ret =3D 0; + + ret =3D whpx_handle_halt_generic(cpu); + + return ret; +} + +static int whpx_handle_hyperv_guestidle(CPUState *cpu) +{ + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; + int ret =3D 0; + + env->hflags2 |=3D HF2_HYPERV_HLT_MASK; + ret =3D whpx_handle_halt_generic(cpu); + + return ret; +} + static void whpx_vcpu_kick_out_of_hlt(CPUState *cpu)=20 { WHV_REGISTER_VALUE reg; @@ -1631,7 +1656,8 @@ static void whpx_vcpu_pre_run(CPUState *cpu) /* Get pending hard interruption or replay one that was overwritten */ if (!whpx_irqchip_in_kernel()) { if (!vcpu->interruption_pending && - vcpu->interruptable && (env->eflags & IF_MASK) + vcpu->interruptable && + ((env->eflags & IF_MASK) || env->hflags2 & HF2_HYPERV_HLT_MASK) && (vcpu->tpr < irr || irr =3D=3D 0)) { assert(!new_int.InterruptionPending); if (cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD)) { @@ -1763,9 +1789,10 @@ static void whpx_vcpu_process_async_events(CPUState = *cpu) } =20 if ((cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD) && - (env->eflags & IF_MASK)) || + ((env->eflags & IF_MASK) || env->hflags2 & HF2_HYPERV_HLT_MASK)) = || cpu_test_interrupt(cpu, CPU_INTERRUPT_NMI)) { cpu->halted =3D false; + env->hflags2 &=3D ~HF2_HYPERV_HLT_MASK; } =20 if (cpu_test_interrupt(cpu, CPU_INTERRUPT_SIPI)) { @@ -2035,6 +2062,17 @@ int whpx_vcpu_run(CPUState *cpu) } } =20 + /* Windows and Linux both use this MSR. */ + if (vcpu->exit_ctx.MsrAccess.MsrNumber =3D=3D HV_X64_MSR_GUEST= _IDLE + && !vcpu->exit_ctx.MsrAccess.AccessInfo.IsWrite + && !whpx_irqchip_in_kernel() + && whpx->hyperv_enlightenments_enabled) { + is_known_msr =3D 1; + whpx_bump_rip(cpu, &vcpu->exit_ctx); + ret =3D whpx_handle_hyperv_guestidle(cpu); + break; + } + /* * Linux tries to use it anyway even when not exposed.=20 * Ignore the write as the VP assist page is not used. --=20 2.50.1 (Apple Git-155)