From nobody Sun Apr 12 04:21:46 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=1770789355; cv=none; d=zohomail.com; s=zohoarc; b=l0pA8M1u0C/0jbpEOhjaskwyJDBCEv0TpXGsUYdAXCxsc9QBdi/6BVmN0aNmpdwiXrH1j9MrEKAaPCnVXkhGPOZ3atuquLiF8C7GZK7T+GlSNZfQVOp+xtJGR9cPYGmp1v/ns6MMBWUkR/QpgQwc93eJ1TE/oRvhacXJwd+h23A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770789355; h=Content-Type: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=mOYNtTveKjr+KZigxP71eIiTh5kyqDuwACrDmj+VmsE=; b=VNZ87XmHTOTF2qWgkGP3bGoOEnYDE/Z43kVjQ4XGS4U5U4NR3rgsTZfW3ROXfwKEpp8ssLt2Vg49Z7TRr+JI5jCLEwY+3Hr1fsslyY3UPkqsCjzvV1m+oJA9nq5PW+9Cry1kisjscc+EHG/0Rgl4ZR77vQSqz8C0ZHRxgok5+U0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770789355313128.14055170198606; Tue, 10 Feb 2026 21:55:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vq3B3-0005V0-2m; Wed, 11 Feb 2026 00:54:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B2-0005U6-5C for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:16 -0500 Received: from p-west3-cluster1-host9-snip4-7.eps.apple.com ([57.103.73.218] helo=outbound.ms.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3Aw-0002oW-3P for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:14 -0500 Received: from outbound.ms.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPS id 05C8F18000AB; Wed, 11 Feb 2026 05:54:04 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.154.37]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPSA id 235EB18000A7; Wed, 11 Feb 2026 05:54:01 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770789245; x=1773381245; bh=mOYNtTveKjr+KZigxP71eIiTh5kyqDuwACrDmj+VmsE=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=ADwTeUrkNeT+z3W95Fi1NV2pk3P+WsbkwPV/VvkiAW0z3QKBoWHzTQs9EYY4tNo+RsChfBAxhtff0icFcjEJ3YiWqoBsHgtBx10fZoqDJ1yrsBxQxvotlK6h8/asvXaWZIJZeeF3u9fV72tLaXE1eOvmtjLC3H0yGaMIULgjO6XQpQNJI0Vud+RY/ySTZtfdsy+91eWfDno0Y5xF1ERkNthrg3Np/OMo+z/NW5YUvmCztpEx/ktX/LbTDcEIYtwFgxU0des34RirWVOoFov2cTqHH5pPItG2ieRTn/3sLHMLyPvZXAPnGomct8GyuOC0qOZbDAcgY0qVsrlk5SAH3Q== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Wei Liu , Roman Bolshakov , Pedro Barbuda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cameron Esfahani , Zhao Liu , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Magnus Kulke , Mohamed Mediouni , Paolo Bonzini Subject: [PATCH 1/7] whpx: re-enable guest debug support on x86 Date: Wed, 11 Feb 2026 06:53:46 +0100 Message-ID: <20260211055356.44664-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260211055356.44664-1-mohamed@unpredictable.fr> References: <20260211055356.44664-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDA0NiBTYWx0ZWRfX25KRu0dOpu0T DR6GRiADzq9nI2HZbBD1nERmG3seUZiiZFFrP2+1dBzGv8c2ZqJlYaEfpOg4dgRKWmpzrLYwZQo 3oefRo587ODTdgC/KExjGIyd5J1fb7qVWXr4HSpHDtii5GrastOAtwBZEJrKKorVgdSmV5TpsO4 PcV7u21vgVSicP87c1IyVWcC9yqEGeBhaQR4ufkdCUAWbNI02X1e21aKzVaI6zWLZV/maB7eYaj HSKaM7Tcx4KNk/pZL0rxkPmVcf5rCXfxtCcawVyJglNz9/4DcEeC8p8/WIb1bnrNkndCIy0Q450 yEa9sxvIAQPrfrSCvK6LvIXU+E7UvPNFy0CnPy1XwWgmFszj21y7MaRduwaZW0= X-Proofpoint-ORIG-GUID: tbNPRdUbKfG2RTYrQNqGBiJVT58RJZIM X-Authority-Info-Out: v=2.4 cv=J62nLQnS c=1 sm=1 tr=0 ts=698c197d cx=c_apl:c_apl_out:c_pps a=qkKslKyYc0ctBTeLUVfTFg==:117 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=TBIg4pHv79D69QLdSdkA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: tbNPRdUbKfG2RTYrQNqGBiJVT58RJZIM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_03,2026-02-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 clxscore=1030 mlxlogscore=999 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110046 X-JNJ: AAAAAAABM+/IpeD3w4cDLlkFxkD+Pois0n8fMl4RN1YV/hZsl216g+Mt9eMUxvzMh2LFQWU3ciTfdnEhPXvSzt+Q3Td1JY7Hvtw9KcexF9JKtVEmNkEcEMqGHSPayeJE4Yk2Vir8psz+mKNAq5R+HeXb3ZfOmPEgZtpm3jwQv+0LyX55ftxwwOmizRKshnb3+bhFi17+ItYZVWdParf7AvGMm6cbKK1xaQARORkTxy5r3LpZ2ubr2vTO91zUUkRM8sPGyiyNwd6H2DIUCxY0augZ3pdODHKw6JUEYHUtlcYCgtA8qA2p46nqy5k5vVt73+iArQVFsa33CnoOdQT9PElvV1CKe4lMMWcBgB3UKWmu9Q2D8tHqgndmAQ5a6I6NVWwRaNKd1f6GoxAQe5IFVNteHLrC8A9ooAuM+B4yiiigTYigohbh9oLCizsFpE29SKajjoU8atkX+KfnVuC6PFglpLQcHdtSiCeJc2qZ+6MMv64ybEeZugk+3Tk/+cYP7RKcORCiNrdwnY54bcI3TVA4SuFqutf+FD5QWS+aYNKfh9OGTSiMNkNDzLgvpY/9xIPX6caRwJbYBcqvAFUMw9r7/kFrIg79Dyh1v1Q4btrPD/qdNzm/i1DsTyZ4UWwYuHoM22N3f75+F14wjvsUKi5GImgVaStpbx42YwcYFPikFg20fqLfEqzUWw/RolXGhWdxuQ2KxmggX8TTCSWVPvFS9s2a7EA0WT7YeDnjtRCdZBpy4z5ESQKVqRG+2QMo5F+TS8iTHZ85C2z7bywqNiIfXQGk3NPsjbcrCKU18sOq Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=57.103.73.218; envelope-from=mohamed@unpredictable.fr; helo=outbound.ms.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: 1770789356994154100 Fix what got broken several years ago by adding ops->supports_guest_debug support as an architecture-specific function. arm64 WHP doesn't currently provide support needed for this. Signed-off-by: Mohamed Mediouni --- accel/whpx/whpx-accel-ops.c | 8 ++++++++ include/system/whpx-all.h | 4 ++++ target/arm/whpx/whpx-all.c | 5 +++++ target/i386/whpx/whpx-all.c | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/accel/whpx/whpx-accel-ops.c b/accel/whpx/whpx-accel-ops.c index 50fadea0fd..b8f41544cb 100644 --- a/accel/whpx/whpx-accel-ops.c +++ b/accel/whpx/whpx-accel-ops.c @@ -17,6 +17,7 @@ =20 #include "system/whpx.h" #include "system/whpx-internal.h" +#include "system/whpx-all.h" #include "system/whpx-accel-ops.h" =20 static void *whpx_cpu_thread_fn(void *arg) @@ -81,6 +82,12 @@ static bool whpx_vcpu_thread_is_idle(CPUState *cpu) return !whpx_irqchip_in_kernel(); } =20 +static bool whpx_supports_guest_debug(void) +{ + return whpx_arch_supports_guest_debug(); +} + + static void whpx_accel_ops_class_init(ObjectClass *oc, const void *data) { AccelOpsClass *ops =3D ACCEL_OPS_CLASS(oc); @@ -89,6 +96,7 @@ static void whpx_accel_ops_class_init(ObjectClass *oc, co= nst void *data) ops->kick_vcpu_thread =3D whpx_kick_vcpu_thread; ops->cpu_thread_is_idle =3D whpx_vcpu_thread_is_idle; ops->handle_interrupt =3D generic_handle_interrupt; + ops->supports_guest_debug =3D whpx_supports_guest_debug; =20 ops->synchronize_post_reset =3D whpx_cpu_synchronize_post_reset; ops->synchronize_post_init =3D whpx_cpu_synchronize_post_init; diff --git a/include/system/whpx-all.h b/include/system/whpx-all.h index f13cdf7f66..3db074c38c 100644 --- a/include/system/whpx-all.h +++ b/include/system/whpx-all.h @@ -17,4 +17,8 @@ void whpx_translate_cpu_breakpoints( struct whpx_breakpoints *breakpoints, CPUState *cpu, int cpu_breakpoint_count); + +/* called by whpx-accel-ops */ +bool whpx_arch_supports_guest_debug(void); + #endif diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index 36c5e30a03..8d0ca794af 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -304,6 +304,11 @@ void whpx_translate_cpu_breakpoints( /* Breakpoints aren=E2=80=99t supported on this platform */ } =20 +bool whpx_arch_supports_guest_debug(void)=20 +{ + return false; +} + static void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTE= R_VALUE* val) { struct whpx_state *whpx =3D &whpx_global; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 8210250dc3..e1f0fa5e77 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1272,6 +1272,11 @@ void whpx_apply_breakpoints( } } =20 +bool whpx_arch_supports_guest_debug(void)=20 +{ + return true; +} + /* Returns the address of the next instruction that is about to be execute= d. */ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid) { --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:46 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=1770789345; cv=none; d=zohomail.com; s=zohoarc; b=kUYOtc37JXdcarrT9zcwXx2Z7HLB7UzOwh+EQdAwbS0bn0LXjEBOxI8F+uD7hrTiJ1/+bdiu++cjiJftA4JrRa4+W1EOx4EPnVI1VhKR2ykLUxcCW1ugRg82iEJTJb19S5YAUJ0GCY4zbN2obbmkP0hXD31cICRjWif2Apvel7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770789345; 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=Fw0z6+iB9F4AovKxBQeeShFALB8YJtbOsN+Uwg/naV8=; b=ACFP3N1JthJWTWVbCBZegTJO3aR0SuiiMVMmheQ9drR2BXbgpoT0/b4G1MpJkI/ylh7HJSrt1DhjpxuMhNZ/WiDPAS3IWnuat4NyQSvLWFwo3i40+B1v6nUCiB7g4d4IBuLKl8c3+eyCxYjYR5JlA+Bhgay0f1aBhXTee1liVnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770789345093519.4756522346956; Tue, 10 Feb 2026 21:55:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vq3B6-0005WW-Mn; Wed, 11 Feb 2026 00:54:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B2-0005U8-5V for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:16 -0500 Received: from p-west3-cluster1-host6-snip4-10.eps.apple.com ([57.103.73.191] helo=outbound.ms.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3Ay-0002pN-Ab for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:15 -0500 Received: from outbound.ms.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPS id 3D8A51800182; Wed, 11 Feb 2026 05:54:08 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.154.37]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPSA id 25A1A18000AD; Wed, 11 Feb 2026 05:54:04 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770789250; x=1773381250; bh=Fw0z6+iB9F4AovKxBQeeShFALB8YJtbOsN+Uwg/naV8=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=AiunL6BzlliijdUih+t/okZtiz2HPLzK6PVqs/l53C6NWgz9g4tjM8NgUORCDLj266g7L3JadqZAwyfjZ0Ri6CoUun+dSyiueXq+vAPbWCll4BDzVvrf/s9z3z711f10Q1ygzRR7ZUS38Q29ynUj468NxqZCZKf/kLW+MsWQkoqOKWSCeuR2mMcOnVWRkBwX4aPRDrLpOvq/IQrIST6kGX+ZHB9qoT6mPDxiIMjJ3hde+rjamdYRNz4xfiedtPHIIhD6pxErqR230tRGaKmo4mvvlTQauhFvWmTQQngJ32RQyCRCqOshJeinLsE+POURjkCvaQxbkh3mUjSK8BkH7g== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Wei Liu , Roman Bolshakov , Pedro Barbuda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cameron Esfahani , Zhao Liu , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Magnus Kulke , Mohamed Mediouni , Paolo Bonzini Subject: [PATCH 2/7] whpx: preparatory changes before switching over from winhvemulation Date: Wed, 11 Feb 2026 06:53:47 +0100 Message-ID: <20260211055356.44664-3-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260211055356.44664-1-mohamed@unpredictable.fr> References: <20260211055356.44664-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: MkUbxFBx3zZaj4x50-GP-B8ZQUEh3dwJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDA0NiBTYWx0ZWRfXx0HNotZbwamy 7xB9BbcCLzd4Dm8FpjycpkuBXShqN8WnHeNrOjWv1IVu5x9zImPtJ50q9mzSv0pR28MMeNSixuy 7ffANeXcarGPi1OpQ8h3/OdKYS7sCCYKPar8mqITRrmmGc+wwyADvZPlBhSJe7xBeslOH+36TXt TyAjg0Xn4D2PAk+I8iirjTm5aw0lg9EfqIEgp6o1dOZAHt9ag/g1JYNdXEQ0lra1kJvvcFQlZLq moQbvVmRLVUcjlouqXD2RBa3U7aFR2EvFe5CCh+MTkBeU90tVzBTeXyuMrbbOIo04npqx+KRBgo NqVZzrGXUVbultQqvhJdoFSr2Hb3JRTpFE0rLGB42jf6GWqxnRtDX6qgcSe/Tw= X-Authority-Info-Out: v=2.4 cv=Q7ffIo2a c=1 sm=1 tr=0 ts=698c1981 cx=c_apl:c_apl_out:c_pps a=qkKslKyYc0ctBTeLUVfTFg==:117 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=3ZNzUvD_rHpfP4YyWhIA:9 X-Proofpoint-ORIG-GUID: MkUbxFBx3zZaj4x50-GP-B8ZQUEh3dwJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_03,2026-02-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=943 adultscore=0 malwarescore=0 bulkscore=0 mlxscore=0 clxscore=1030 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110046 X-JNJ: AAAAAAABOCGHBnnZUvLd2ksjkdBtpVswliZaFkOjLmiMZN6Xt1zLjkO8gO4M0iDtaDqmgkHonlB8LyktYFc5K4Q9+cuAkS6QYOrM9UXEv+babCsznzr3LNTOtBdWRuszi0cSZMcs0hJYpBz6I3/IxVgEy2JJ7XascCA9Y+H38BNse6WpVPtG2/k2vGkr2WRhl4HDWWPFkwS+vbMqdIv2mpMvfrkWW45lDYmcOdxNaBObfMB2uun0GYBQx3+V+T9B0REqUHSVMRQbJbhLFL9SHwyaoIWxF854N20owSAt7SMOthnEm1rU9vybQqhp/ICisug3Szd64WI3UCDcPGBO4HAp7cr4vx/IyzMd94Qprap3x2FQmKzcwwD6vqaaOItxqUNjDxvgqJmQwu4ouPIHFjnSPBlIGQE7xEft+NoyyA3RwHAuzbwx9125gKfhpDW1OMX49J3obWVz7qk1CzHMsag1Bd3uLK3V0hIKJCMhHHGzzIzsO686N2MSiw2VybDIm+kEbTZeocBYJwnNCCgp4fJ9JRv0BkHeEKVaavm51ZW1jP76LsRCYvR0nBeOQs57p8pfpvpuvYIhHowjeAzYd0XwwzYHbhmJtd/hNjEz+M4gK9NFpCmC1TK6D+1a/SWXPDOLT25O+IipnIYSBDDGIxZPYOSdT9lItHGKy4QxbuvPUzabW92wttfu2O0CdrhC+ZJ3RhbCegZtl7IVbiN4C6sKwCfaUGfvsjfWy2qyymawRV38QezFqopcUbGTCGOSVnhVVAw+7zU/KoUWHFHTth3C6onPlbQ5cZg= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=57.103.73.191; envelope-from=mohamed@unpredictable.fr; helo=outbound.ms.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=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: 1770789348144158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- target/i386/cpu.h | 2 +- target/i386/emulate/meson.build | 1 + target/i386/mshv/meson.build | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index da5161fc1a..2f92ee9d48 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2270,7 +2270,7 @@ typedef struct CPUArchState { QEMUTimer *xen_periodic_timer; QemuMutex xen_timers_lock; #endif -#if defined(CONFIG_HVF) || defined(CONFIG_MSHV) +#if defined(CONFIG_HVF) || defined(CONFIG_MSHV) || defined(CONFIG_WHPX) void *emu_mmio_buf; #endif =20 diff --git a/target/i386/emulate/meson.build b/target/i386/emulate/meson.bu= ild index b6dafb6a5b..3560f8dda6 100644 --- a/target/i386/emulate/meson.build +++ b/target/i386/emulate/meson.build @@ -6,3 +6,4 @@ emulator_files =3D files( =20 i386_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: emulator_files) i386_system_ss.add(when: 'CONFIG_MSHV', if_true: emulator_files) +i386_system_ss.add(when: 'CONFIG_WHPX', if_true: emulator_files) diff --git a/target/i386/mshv/meson.build b/target/i386/mshv/meson.build index 647e5dafb7..3fadd4598a 100644 --- a/target/i386/mshv/meson.build +++ b/target/i386/mshv/meson.build @@ -6,3 +6,7 @@ i386_mshv_ss.add(files( )) =20 i386_system_ss.add_all(when: 'CONFIG_MSHV', if_true: i386_mshv_ss) + +i386_system_ss.add(when: 'CONFIG_WHPX', if_true: files( + 'x86.c', +)) --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:46 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=1770789315; cv=none; d=zohomail.com; s=zohoarc; b=g4vioye23msLLRZ6YTdqo0IAEDseBgcHmZa7L8Po45kqWHbfam3WjhhlPKoYTBeWCv3cpCpGyg+SMMNtkNbPH1af+Mw8aG7PZ18HLCR+4KLC+lU4I2K3GrowtUU3BXVk6cN1S4VScNGXpx/hpcY3DcOO5gn30NyWVV7iWrC0+fE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770789315; 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=SzPbZCaUO3NDYpRGPHTDqVjE5jH4BjEtis7wSjOSTkA=; b=Yt8JnZrC35xc5iA3C7WKT/bAewVko59YFvohRrm5PBSLvIy1Oal12kg+dYvY7cVFXl6IhUg3FH9swswlmwbZcbgk7BRrcsZ+LE5xCyUi7tC7fU8v06OFJFZcOlvh9Mo9zCBobcbfYVJiu0JG5MqcukGy9pSbgDzeqje2yPLiMMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770789315298874.2737262329258; Tue, 10 Feb 2026 21:55:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vq3B6-0005W0-81; Wed, 11 Feb 2026 00:54:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B2-0005UA-5g for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:16 -0500 Received: from p-west3-cluster1-host12-snip4-10.eps.apple.com ([57.103.73.251] helo=outbound.ms.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3Az-0002pq-V7 for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:15 -0500 Received: from outbound.ms.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPS id 3DED918000A7; Wed, 11 Feb 2026 05:54:11 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.154.37]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPSA id 2405A18000BC; Wed, 11 Feb 2026 05:54:07 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770789253; x=1773381253; bh=SzPbZCaUO3NDYpRGPHTDqVjE5jH4BjEtis7wSjOSTkA=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=AGXIzEUHsyN+agiXpMN6GpCqxHJoDuyo2Z2VuLqy6EtNFOeiJlF/Ga49qbfoxmmuKi6T5t9EtTiLetX8eyvj7MolZ3muu4wcyaOH9eFQdNrSq7MFFFa38ardexuvyccKY74rRrEBnyaOKZQ+oPEFdEbvSudxBi2ipLIzRKlFGWl5d7lh32N+7KLu1mFsPxx+qUwx/CJdN0KlQuUKyJC4Lmx3J9p+17ezRA9vtUAEx8kib2HKUVokUWtXCKw0SN9QXa/k2aj/aZjwh7a1JS/PLtF26trOOPksw1VIDxvPjUZ8ECFFC/juo5VJlqNeSEa8YhRTz2jSukOXX8F5v4mLeg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Wei Liu , Roman Bolshakov , Pedro Barbuda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cameron Esfahani , Zhao Liu , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Magnus Kulke , Mohamed Mediouni , Paolo Bonzini Subject: [PATCH 3/7] whpx: refactor whpx_destroy_vcpu to arch-specific function Date: Wed, 11 Feb 2026 06:53:48 +0100 Message-ID: <20260211055356.44664-4-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260211055356.44664-1-mohamed@unpredictable.fr> References: <20260211055356.44664-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: SXQ-93R9Brj3969dJPjsaGDZdI09jgDr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDA0NiBTYWx0ZWRfXz6c6hgIphOnX DdaWvQJ77Po9609hSzjn5kV06EBZTwqQIgSG6CtPSXO6OZ41ybXAamCY41Ln0ucgujNNW89Vu6e FQ0qT9b2DZ6i//uoM3ik/GRUCM0Kqg6kL/sDQEyUbxp0pDXnQclKiRudpBKBi163dJtnsPJRlol 15b3XaUSqa/OGoghUqUfJOguxAFZtonW6IoFIcPsp9EhoZOWjciylJ1cPgmCBb9pYzMTG7BjBj4 aB0nlXkQOJ+kWFTM55xc9ff2NF/iljRKqauWuEcgA8aoxMww1ThwcYk+Hst+6XaLOIAafjKOFNw NwnMhmX+GsvcJFC9C9dNC/qusP5KphKna2EiqOit/gmfRKECA7D7XDcbOlisPY= X-Authority-Info-Out: v=2.4 cv=Q7ffIo2a c=1 sm=1 tr=0 ts=698c1984 cx=c_apl:c_apl_out:c_pps a=qkKslKyYc0ctBTeLUVfTFg==:117 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=MnziPJL1nimGiMRD7rAA:9 X-Proofpoint-ORIG-GUID: SXQ-93R9Brj3969dJPjsaGDZdI09jgDr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_03,2026-02-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 bulkscore=0 mlxscore=0 clxscore=1030 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110046 X-JNJ: AAAAAAABPPTIl41WYVFr5IFZDkytF57zw6Y+JlV9p1CsxNPAWom+OsTGrOXcE5kkmK15QwZVqzXzqgnF7eML5VtKDE0XwBTEUbsGijnfF40epESx7L4CIZgkl/S7diG2JEx98J9Awj4pWSJnCvq0M8U0CJAkXbnfptsvzJ2nVycBSaFtm3XZ+vMcDCHUV2CMrSiTPQ81hB4E6Cr7bomNz17v5TyDA6LlnLRKqsUNVvPU5G5r7JG/XF9OK+QvWckLai0Bl6pKFsLmO58LXX96HgRfyklfuqlT2T3upcrEmjb11KlKAuEGo2NKzxl8tnEjKye222MQhAl63xu6MVgeeB9UJfvrE/5bvMUFFBFjQCLovS9NKWPWLSWWJDE/AaRhG3ievgy331TbN1/sjzcPZp5FjPtvALhvG8PLjGrfZwFsANqN6wbUN28vHbcfPjoKNdndY8d+HdvvmnXSc9yf9S39xVoIu9WLl1+s9LHquVBp3KKTLT85LV+3oX7kjrWeDa++Z+f+8mJpOYid+PIxFZt1ScgfYa8gFZFqsL7fItBEuLjCDR2Zx016SYMe5GDXF95DGaMBXsVuhdx2vrzw8HCYHwmBeYz19aLCJAE5iAgx2p0Tg3hIg66d9ch66JmODgJ2R2tqbmNlV5q5esJ8EUfLfnWyUzARz9a8k0KCXHi1GXLBFiS0HX10eADOXrKNAuCgSt9QaPfUTXB0KHMW6lVWG4tdKyg3PaYSLDSs4s+igxckcx6YGvESywjZJudCezCHJ1LkE+Kw6EIAa+wvLuAU1g== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=57.103.73.251; envelope-from=mohamed@unpredictable.fr; helo=outbound.ms.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: 1770789320801154100 Content-Type: text/plain; charset="utf-8" Avoid a TARGET_X86_64 define by moving platform-specific code away from generic WHPX support. Signed-off-by: Mohamed Mediouni --- accel/whpx/whpx-common.c | 5 +---- include/system/whpx-all.h | 1 + target/arm/whpx/whpx-all.c | 5 +++++ target/i386/whpx/whpx-all.c | 6 ++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index f018a8f5c7..c57a0d3f0f 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -236,10 +236,7 @@ void whpx_destroy_vcpu(CPUState *cpu) struct whpx_state *whpx =3D &whpx_global; =20 whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index= ); -#ifdef HOST_X86_64 - AccelCPUState *vcpu =3D cpu->accel; - whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); -#endif + whpx_arch_destroy_vcpu(cpu); g_free(cpu->accel); } =20 diff --git a/include/system/whpx-all.h b/include/system/whpx-all.h index 3db074c38c..b831c463b0 100644 --- a/include/system/whpx-all.h +++ b/include/system/whpx-all.h @@ -17,6 +17,7 @@ void whpx_translate_cpu_breakpoints( struct whpx_breakpoints *breakpoints, CPUState *cpu, int cpu_breakpoint_count); +void whpx_arch_destroy_vcpu(CPUState *cpu); =20 /* called by whpx-accel-ops */ bool whpx_arch_supports_guest_debug(void); diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index 8d0ca794af..d52580a082 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -309,6 +309,11 @@ bool whpx_arch_supports_guest_debug(void) return false; } =20 +void whpx_arch_destroy_vcpu(CPUState *cpu) +{ + /* currently empty on Arm */ +} + static void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTE= R_VALUE* val) { struct whpx_state *whpx =3D &whpx_global; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index e1f0fa5e77..cdcaebbe16 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1277,6 +1277,12 @@ bool whpx_arch_supports_guest_debug(void) return true; } =20 +void whpx_arch_destroy_vcpu(CPUState *cpu) +{ + AccelCPUState *vcpu =3D cpu->accel; + whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); +} + /* Returns the address of the next instruction that is about to be execute= d. */ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid) { --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:46 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=1770789339; cv=none; d=zohomail.com; s=zohoarc; b=QXCAMkPPTOu/RT0piick8KaGcBZSsw7qQuMfXkg7GZzYPhQ+Y8+jLqszxJwuDQnX+40AHAgF527s1amSPR+/aPZEklgxHrdR8M7BE6EUj/xUa6oFzh9Fy1W4OPBCwrxvyLu94S+/t42Vsz04c1qrlsAiURRk55N8NTIGIYIXJwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770789339; 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=be0nJ130zvvK9XI/bsScdXF1W7wGDBAIgGEUgggxqUo=; b=mjnMmO7mYZBwHH15+FOuWAZdiwA4NqXsKRmOa98YiM4nHMJl37MU86a2bBWlgNW7JvW9RneWHXI8wICTl+kVQ0UjPUjnT35AQ2Y32SmvbRrp/jrYIqZEkAKkEQZBwMxJ7Hv2ExuzZPDPBdFCnGrsQphyRggozD/9MxlWyiMIg94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770789338569944.2012600890283; Tue, 10 Feb 2026 21:55:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vq3B7-0005X8-Hr; Wed, 11 Feb 2026 00:54:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B5-0005Vl-O8 for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:19 -0500 Received: from p-west3-cluster1-host5-snip4-3.eps.apple.com ([57.103.73.174] helo=outbound.ms.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B4-0002rD-3A for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:19 -0500 Received: from outbound.ms.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPS id 5956F18000BC; Wed, 11 Feb 2026 05:54:14 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.154.37]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPSA id 243D318000A6; Wed, 11 Feb 2026 05:54:10 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770789256; x=1773381256; bh=be0nJ130zvvK9XI/bsScdXF1W7wGDBAIgGEUgggxqUo=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=SbgabOniZt9YrOP4AeYKVtoZ2WdG/VJi5bowBWnGoC9Enqi/UHHnoWe7eoa6T78m25lvy8vmAgdSjo3pI52fX5mG0UlGuDww6bJ/7oAmKK2mCQgNJqhHurUtj3+opVtqg1ISEXzA9cf4DW1vh4JE7UM7oOMWE+qveO6VH9jiLZucYM1iX44eyUPqjctje87XTMbAiiTwDNLyTI6jSOumUuBWGLmnAUN2U2etORbV4ZKAnAL+PRSqCuYt+G6NKEEW2NC4VhN5N8QZltA3m30UGSy1BE9uljg4NvHdjm70CNHlNK3SHRW6M52syPOIHUkCVUziL7q1k7HFJj/heDxHqA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Wei Liu , Roman Bolshakov , Pedro Barbuda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cameron Esfahani , Zhao Liu , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Magnus Kulke , Mohamed Mediouni , Paolo Bonzini Subject: [PATCH 4/7] whpx: move whpx_get_reg/whpx_set_reg to generic code Date: Wed, 11 Feb 2026 06:53:49 +0100 Message-ID: <20260211055356.44664-5-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260211055356.44664-1-mohamed@unpredictable.fr> References: <20260211055356.44664-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: z9F7oq1wNg3pPcNdbaDLYi1EFGzph4QM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDA0NiBTYWx0ZWRfX+Nb9XF5cAiHe Lnb9x7Y46kQ/amUNVrpJp4tACtojAW+yhtV1MxMC7lOBHTwR1NDAI8j2No3ISBwQh8iP7ni38Ue kxNrnqWhky65LtnPgeTHqCVfcD62iwcepb54aAIc5sGaqn0XUcUAEGum0a8/Yh5DGS11IBFtUwd UEc4XLiVQolUH+jDJPnz48Tie6/UL28BXWC/en4Xbfr/HIZtqVKJ8CU+U4F1m/MfLTucSMWttpe BWRrV3c/6/ROq0O+LrspTOo1sxG2K6zkhTcVvWPsXEF/l6fj/NaAw+Uijr1tVZ1trpp6H3ggfw3 5mQGLK7zOwdC+Tjp/gS9RVh8AJ/stqHeKrzmqFkOYYPlYNnp6D4XFGr3jcWKGA= X-Authority-Info-Out: v=2.4 cv=LP5rgZW9 c=1 sm=1 tr=0 ts=698c1987 cx=c_apl:c_apl_out:c_pps a=qkKslKyYc0ctBTeLUVfTFg==:117 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=zEEq2qrNK1eH_SHa7C4A:9 X-Proofpoint-ORIG-GUID: z9F7oq1wNg3pPcNdbaDLYi1EFGzph4QM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_03,2026-02-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 mlxlogscore=973 phishscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 clxscore=1030 bulkscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110046 X-JNJ: AAAAAAABzOXngGvd9ClzZR1X8rVoM5uUFIiPbRwuzT1ZOxK000VjQCLCR0drJOzfSFCk0FXTcr+OnW2XRLMgO176YssbmNU4jVJjSyZ5Dr91BcXTTVb6gH3sXBvog5zQ18lvmgAdxBlDWUn8jrbK9QKj4wZVw2JBniFZ/wo6cx/6lWF0jRdIzBB/42OBBNrCcVq8a/cY1SxZE3fcswMt6AAP60TBbGsyyKpnmUk5XRm9HyGX5YHeORFW9gmh8SmNYU0Mq1/yYamGRDchHHwO8wOM9pHHFN5zM0TttrDcWhs9/OMnJ6nFRQo4MycOkFoo103MrWwF+eXw2hnsYEE89eVUMeMUiGmzC4C41+kzPrnqfgnvjRGZDfF6SENDig9hqclE0CF+N+ls8INNet1Tdp/5Dk5LAfzQYzf7SbayRc0xtQUIc2ul43VuS+BkxpyWTAlDLIMLYYSQmz4FEly4FQcKgSQhJF/tYlR1OEk8u9mV6shbdJYQFSBNEaXj81E6RYAnKyJKAEtoOa4PYRjSRh/R9Pb/1uV66rWaIEr3O0i1dzqFfofb9KbGVh0zOg/Fw8DZuCHGAjh5Hwju9Xbgsu9xAxTf5rI6sDquRcred04DsvZel97DfbMkESRsPy525/weqItgOc3Z0QtTIdwSgMAPw9vjcL8rr+nqvBPj5AvbmSDVzc/b06hzkuSnMCcMdGrt8eR1Q1su+wLXu0zzOyDf5COVCCyDiUPDd8r+LTc3htAizcQ8JEg+hv1P2RzV07tnVM9D4Uo= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=57.103.73.174; envelope-from=mohamed@unpredictable.fr; helo=outbound.ms.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: 1770789341010154100 Content-Type: text/plain; charset="utf-8" These will be used in the next commit on the x86_64 backend too. Also move flush_cpu_state as it's used by get_reg/set_reg and the arm64 cod= e. Signed-off-by: Mohamed Mediouni --- accel/whpx/whpx-common.c | 35 +++++++++++++++++++++++++++++++++++ include/system/whpx-common.h | 3 +++ target/arm/whpx/whpx-all.c | 35 ----------------------------------- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index c57a0d3f0f..c2263c2496 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -46,6 +46,41 @@ static HMODULE hWinHvEmulation; struct whpx_state whpx_global; struct WHPDispatch whp_dispatch; =20 +void flush_cpu_state(CPUState *cpu) +{ + if (cpu->vcpu_dirty) { + whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); + cpu->vcpu_dirty =3D false; + } +} + +void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VALUE= * val) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + + flush_cpu_state(cpu); + + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters(whpx->partition, c= pu->cpu_index, + ®, 1, val); + + if (FAILED(hr)) { + error_report("WHPX: Failed to get register %08x, hr=3D%08lx", reg,= hr); + } +} + +void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VALUE= val) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters(whpx->partition, c= pu->cpu_index, + ®, 1, &val); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set register %08x, hr=3D%08lx", reg,= hr); + } +} + /* Tries to find a breakpoint at the specified address. */ struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t address) { diff --git a/include/system/whpx-common.h b/include/system/whpx-common.h index b86fe9db6e..5bce33e336 100644 --- a/include/system/whpx-common.h +++ b/include/system/whpx-common.h @@ -20,6 +20,9 @@ int whpx_first_vcpu_starting(CPUState *cpu); int whpx_last_vcpu_stopping(CPUState *cpu); void whpx_memory_init(void); struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t address); +void flush_cpu_state(CPUState *cpu); +void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VALUE= * val); +void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VALUE= val); =20 /* On x64: same as WHvX64ExceptionTypeDebugTrapOrFault */ #define WHPX_INTERCEPT_DEBUG_TRAPS 1 diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index d52580a082..c8d71a252e 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -274,14 +274,6 @@ static struct whpx_sreg_match whpx_sreg_match[] =3D { { WHvArm64RegisterSpEl1, ENCODE_AA64_CP_REG(4, 1, 3, 4, 0) }, }; =20 -static void flush_cpu_state(CPUState *cpu) -{ - if (cpu->vcpu_dirty) { - whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); - cpu->vcpu_dirty =3D false; - } -} - HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions) { if (exceptions !=3D 0) { @@ -314,33 +306,6 @@ void whpx_arch_destroy_vcpu(CPUState *cpu) /* currently empty on Arm */ } =20 -static void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTE= R_VALUE* val) -{ - struct whpx_state *whpx =3D &whpx_global; - HRESULT hr; - - flush_cpu_state(cpu); - - hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters(whpx->partition, c= pu->cpu_index, - ®, 1, val); - - if (FAILED(hr)) { - error_report("WHPX: Failed to get register %08x, hr=3D%08lx", reg,= hr); - } -} - -static void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTE= R_VALUE val) -{ - struct whpx_state *whpx =3D &whpx_global; - HRESULT hr; - hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters(whpx->partition, c= pu->cpu_index, - ®, 1, &val); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set register %08x, hr=3D%08lx", reg,= hr); - } -} - static void whpx_get_global_reg(WHV_REGISTER_NAME reg, WHV_REGISTER_VALUE = *val) { struct whpx_state *whpx =3D &whpx_global; --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:46 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=1770789361; cv=none; d=zohomail.com; s=zohoarc; b=i3o60gcpSSsRxm/SmX/49bnZeK+09XFP6OlXNU2ynpatVQYNmqljmPn8u8SFo3GgihmHtCvAXWa3tDBQX0FB6pAybgpub9eHuK/7Ps0Zr02s5fQkh3Nal4mLT6aR1EM7oK1Bas4QExTjHr0MuDTD4BASNY42VLIBxjbnlBbc+Fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770789361; 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=BjBElD2Ry3fXf057R0RLxYOzOE9f1h3t5juRI+kKJTI=; b=mPWvXXYwRuupUi0ABnPBnvHdqA7kDb5BbXVchkdAuovx6flzec/QRlsffsgXr5Fi/b7X5zVqyv4RjJJoaHltXBNEpRHECzqZmcE3NAyCxuO0VTOxBPvrpc6j6ePlcUh/O/7F32d9kBYLUOxLRP7NLb3piPGJ7ta4wlXcKqBUo7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770789361650832.8722605611421; Tue, 10 Feb 2026 21:56:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vq3BA-0005YR-7p; Wed, 11 Feb 2026 00:54:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B8-0005Xa-DI for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:22 -0500 Received: from p-west3-cluster1-host2-snip4-2.eps.apple.com ([57.103.73.143] helo=outbound.ms.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B6-0002ro-5W for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:22 -0500 Received: from outbound.ms.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPS id 52C511800189; Wed, 11 Feb 2026 05:54:17 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.154.37]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPSA id 24C4118000B4; Wed, 11 Feb 2026 05:54:13 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770789259; x=1773381259; bh=BjBElD2Ry3fXf057R0RLxYOzOE9f1h3t5juRI+kKJTI=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=cI/cwTpLDLq90KB9/E9qEzAgVarQVSjVUGEJRA65Og9M/TBd3f9FeUxaamS6sD6ath1kw125CH8csNrPJJBbVQCFrFSG2NBVw+IU0X6UPo9vqtfFeM4GBsfFanKG/AtMYNg0sXRnUc/3l7cok8RCm/jsURCrSgVgizu2x9ofn9ymoxqb6HUc0/ofOSaWCXPymqIb4Q+1C/1KAbQv0V4ru3LUMIwQsspGRoWtXFVmv5iMwr5dBcpYuHVJEd+cZP0EAFHeVuC5y2jGE2wr7f5Cf/tLoKBtNZN5g/9hevEcSLVOEOOYdA1TIDKyW8695s52x7i4MVtX+wdjTAfI8Js1dA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Wei Liu , Roman Bolshakov , Pedro Barbuda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cameron Esfahani , Zhao Liu , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Magnus Kulke , Mohamed Mediouni , Paolo Bonzini Subject: [PATCH 5/7] whpx: x86: switch over from winhvemulation to target/i386/emulate Date: Wed, 11 Feb 2026 06:53:50 +0100 Message-ID: <20260211055356.44664-6-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260211055356.44664-1-mohamed@unpredictable.fr> References: <20260211055356.44664-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=JvH8bc4C c=1 sm=1 tr=0 ts=698c198a cx=c_apl:c_apl_out:c_pps a=qkKslKyYc0ctBTeLUVfTFg==:117 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=oThT452izoIBxcdC9S0A:9 X-Proofpoint-GUID: bM0a1dkFKOxCdir9hYMWRFsj6Movu8Sf X-Proofpoint-ORIG-GUID: bM0a1dkFKOxCdir9hYMWRFsj6Movu8Sf X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDA0NiBTYWx0ZWRfX6AlDLF5BN4wZ yMjAkKiUSlArCqoSt9HU8282CbKpiyTtV5u/B3h4xbaTgmFTr0qNXUrTQCPnFL+u1IsHySoCkjB sinCbchPpQYp0oDB4MTqpSSzW9WEcrRi6gYpuxQaeVmCWCkoulhFj05rfLLpVJoshbDVy9CnlKu aGX6DoPRHCOhb/AVbLWmncJew8XoK4b4rWeSTeQeUHFHNDBwuLKBl7+nzlOnMzcn5kCSvbdf29g /UEXLVSsaAYl9HEkNAIw8iVuMteP4WAFywoNl56uoFLt9YO/qV95Pa0F0dF93A1k7rNFybYDduR JSbGzjnN8nBy9m68poFZhnJQn3IaCJi4O8B7Ll7ky6SPN2tdHYeFi7wa24Nsqc= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_03,2026-02-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 clxscore=1030 phishscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110046 X-JNJ: AAAAAAAB6SOfVm9Fy36vNZli1jJYYSdYtH6YffJZKe0GE16FDliu6P1pel0iNNYQI/tQnkhh9a5EvB24NsSLeghfIkpgxKEDJIrIT7vrgyBt9/XIBfrwYTwKw+42WptAAdP1yE5oQVaEO890RLmAX/0zBsvB8jmK3nWQXx68JAC7QuflHiuv6ov8y4vnml9lTs3lPwgB7sH7FomPA6SOHa/lIPeRYhQ6rk23vLEbuF90bi6fmdBINVoL9fOsnCHfJxf7SW7jMX38absuiCrAqWhFF98OAcT8E+hEcFI7KP8iUoSdBzz9NdGWli9h/MzOItU3Y0EFC4oyca+2doqfQYj0yXRsCGj+bpLUR49XM4dW2TX6APj4PnyhNCCpsfnKF/1GQaHglRBf06u2y5ffqhE1WB40BRt8ZhY/hZVzTodAQAWL/zs16oWgwimEDY8GDDcsqD77M8+v7tVd6XIB82P52zMRECTeiNlwptLn0Mo9L4w/mbHCTd1CzfSOxGOzhtW06vHG9xD7qOsEhgSPe1dcvWXCW8U7ig63b5aKIDWKvPlw1BILcMXbfSV+uLmhPcrqvbLdKx9TN+Vgg8Go/+rPPzHZM4zZwzVBoave909GA0ALLDRu0Izlh567aOPxiOhXosgMC1gIIFBMM6AeCpzc/igyj4UM7oJa3NSBTJe1t2aGqnF99ZLfV80Lxd0J9RvV16hhHG7I0Yk9ZCG1HGNlxwMYtAJ6AUcdUt+TJaWqdpyb1rorwGyvJNINcTOIXHq5CgtyFxPixX9uSafUBIrxiSjwhkgv Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=57.103.73.143; envelope-from=mohamed@unpredictable.fr; helo=outbound.ms.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: 1770789364232158500 Content-Type: text/plain; charset="utf-8" Using the mshv backend as a base, move away from winhvemulation to using common QEMU code used by the HVF and mshv backends. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 299 ++++++++++++++++++++++-------------- 1 file changed, 180 insertions(+), 119 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index cdcaebbe16..68ac9dd6ff 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -15,6 +15,7 @@ #include "gdbstub/helpers.h" #include "qemu/accel.h" #include "accel/accel-ops.h" +#include "system/memory.h" #include "system/whpx.h" #include "system/cpus.h" #include "system/runstate.h" @@ -36,8 +37,11 @@ #include "system/whpx-all.h" #include "system/whpx-common.h" =20 +#include "emulate/x86_decode.h" +#include "emulate/x86_emu.h" +#include "emulate/x86_flags.h" + #include -#include =20 #define HYPERV_APIC_BUS_FREQUENCY (200000000ULL) =20 @@ -756,160 +760,224 @@ void whpx_get_registers(CPUState *cpu) x86_update_hflags(env); } =20 -static HRESULT CALLBACK whpx_emu_ioport_callback( - void *ctx, - WHV_EMULATOR_IO_ACCESS_INFO *IoAccess) +static int emulate_instruction(CPUState *cpu) { - MemTxAttrs attrs =3D { 0 }; - address_space_rw(&address_space_io, IoAccess->Port, attrs, - &IoAccess->Data, IoAccess->AccessSize, - IoAccess->Direction); - return S_OK; + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; + struct x86_decode decode =3D { 0 }; + + whpx_get_registers(cpu); + decode_instruction(env, &decode); + exec_instruction(env, &decode); + whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); + + return 0; } =20 -static HRESULT CALLBACK whpx_emu_mmio_callback( - void *ctx, - WHV_EMULATOR_MEMORY_ACCESS_INFO *ma) +static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) { - CPUState *cs =3D (CPUState *)ctx; - AddressSpace *as =3D cpu_addressspace(cs, MEMTXATTRS_UNSPECIFIED); + int ret; =20 - address_space_rw(as, ma->GpaAddress, MEMTXATTRS_UNSPECIFIED, - ma->Data, ma->AccessSize, ma->Direction); - return S_OK; + ret =3D emulate_instruction(cpu); + if (ret < 0) { + error_report("failed to emulate mmio"); + return -1; + } + + return 0; } =20 -static HRESULT CALLBACK whpx_emu_getreg_callback( - void *ctx, - const WHV_REGISTER_NAME *RegisterNames, - UINT32 RegisterCount, - WHV_REGISTER_VALUE *RegisterValues) +static void handle_io(CPUState *env, uint16_t port, void *buffer, + int direction, int size, int count) { - HRESULT hr; - struct whpx_state *whpx =3D &whpx_global; - CPUState *cpu =3D (CPUState *)ctx; + int i; + uint8_t *ptr =3D buffer; =20 - hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters( - whpx->partition, cpu->cpu_index, - RegisterNames, RegisterCount, - RegisterValues); - if (FAILED(hr)) { - error_report("WHPX: Failed to get virtual processor registers," - " hr=3D%08lx", hr); + for (i =3D 0; i < count; i++) { + address_space_rw(&address_space_io, port, MEMTXATTRS_UNSPECIFIED, + ptr, size, + direction); + ptr +=3D size; } +} =20 - return hr; +static void whpx_bump_rip(CPUState *cpu, WHV_RUN_VP_EXIT_CONTEXT *exit_ctx) +{ + WHV_REGISTER_VALUE reg; + whpx_get_reg(cpu, WHvX64RegisterRip, ®); + reg.Reg64 +=3D exit_ctx->VpContext.InstructionLength; + whpx_set_reg(cpu, WHvX64RegisterRip, reg); } =20 -static HRESULT CALLBACK whpx_emu_setreg_callback( - void *ctx, - const WHV_REGISTER_NAME *RegisterNames, - UINT32 RegisterCount, - const WHV_REGISTER_VALUE *RegisterValues) +static int whpx_handle_portio(CPUState *cpu, + WHV_RUN_VP_EXIT_CONTEXT *exit_ctx) { - HRESULT hr; - struct whpx_state *whpx =3D &whpx_global; - CPUState *cpu =3D (CPUState *)ctx; + WHV_X64_IO_PORT_ACCESS_CONTEXT *ctx =3D &exit_ctx->IoPortAccess; + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; + int ret; =20 - hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( - whpx->partition, cpu->cpu_index, - RegisterNames, RegisterCount, - RegisterValues); - if (FAILED(hr)) { - error_report("WHPX: Failed to set virtual processor registers," - " hr=3D%08lx", hr); + if (!ctx->AccessInfo.StringOp && !ctx->AccessInfo.IsWrite) { + uint64_t val =3D 0; + WHV_REGISTER_VALUE reg; + + whpx_get_registers(cpu); + whpx_get_reg(cpu, WHvX64RegisterRax, ®); + handle_io(cpu, ctx->PortNumber, &val, 0, ctx->AccessInfo.AccessSiz= e, 1); + if (ctx->AccessInfo.AccessSize =3D=3D 1) { + reg.Reg8 =3D val; + } else if (ctx->AccessInfo.AccessSize =3D=3D 2) { + reg.Reg16 =3D val; + } else if (ctx->AccessInfo.AccessSize =3D=3D 4) { + reg.Reg64 =3D (uint32_t)val; + } else { + reg.Reg64 =3D (uint64_t)val; + } + whpx_bump_rip(cpu, exit_ctx); + whpx_set_reg(cpu, WHvX64RegisterRax, reg); + return 0; + } else if (!ctx->AccessInfo.StringOp && ctx->AccessInfo.IsWrite) { + RAX(env) =3D ctx->Rax; + handle_io(cpu, ctx->PortNumber, &RAX(env), 1, ctx->AccessInfo.Acce= ssSize, 1); + whpx_bump_rip(cpu, exit_ctx); + return 0; + } + + ret =3D emulate_instruction(cpu); + if (ret < 0) { + error_report("failed to emulate I/O port access"); + return -1; } =20 - /* - * The emulator just successfully wrote the register state. We clear t= he - * dirty state so we avoid the double write on resume of the VP. - */ - cpu->vcpu_dirty =3D false; - - return hr; + return 0; } =20 -static HRESULT CALLBACK whpx_emu_translate_callback( - void *ctx, - WHV_GUEST_VIRTUAL_ADDRESS Gva, - WHV_TRANSLATE_GVA_FLAGS TranslateFlags, - WHV_TRANSLATE_GVA_RESULT_CODE *TranslationResult, - WHV_GUEST_PHYSICAL_ADDRESS *Gpa) +static int translate_gva(const CPUState *cpu, uint64_t gva, uint64_t *gpa, + WHV_TRANSLATE_GVA_FLAGS flags) { HRESULT hr; struct whpx_state *whpx =3D &whpx_global; - CPUState *cpu =3D (CPUState *)ctx; - WHV_TRANSLATE_GVA_RESULT res; + WHV_TRANSLATE_GVA_RESULT translation_result; + + /* perform the call */ + hr =3D whp_dispatch.WHvTranslateGva(whpx->partition, cpu->cpu_index, g= va, flags, &translation_result, gpa); =20 - hr =3D whp_dispatch.WHvTranslateGva(whpx->partition, cpu->cpu_index, - Gva, TranslateFlags, &res, Gpa); if (FAILED(hr)) { - error_report("WHPX: Failed to translate GVA, hr=3D%08lx", hr); - } else { - *TranslationResult =3D res.ResultCode; + error_report("Failed to translate gva (0x%llx) to gpa", gva); + return -1; } =20 - return hr; -} + if (translation_result.ResultCode !=3D WHvTranslateGvaResultSuccess) { + error_report("Failed to translate gva (0x%llx) to gpa", gva); + return -1; + } =20 -static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks =3D { - .Size =3D sizeof(WHV_EMULATOR_CALLBACKS), - .WHvEmulatorIoPortCallback =3D whpx_emu_ioport_callback, - .WHvEmulatorMemoryCallback =3D whpx_emu_mmio_callback, - .WHvEmulatorGetVirtualProcessorRegisters =3D whpx_emu_getreg_callback, - .WHvEmulatorSetVirtualProcessorRegisters =3D whpx_emu_setreg_callback, - .WHvEmulatorTranslateGvaPage =3D whpx_emu_translate_callback, -}; + return 0; +} =20 -static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) +static int guest_mem_read_with_gva(CPUState *cpu, uint64_t gva, + uint8_t *data, uintptr_t size, + bool fetch_instruction) { - HRESULT hr; - AccelCPUState *vcpu =3D cpu->accel; - WHV_EMULATOR_STATUS emu_status; + int ret; + uint64_t gpa; + AddressSpace *as =3D cpu_addressspace(cpu, MEMTXATTRS_UNSPECIFIED); =20 - hr =3D whp_dispatch.WHvEmulatorTryMmioEmulation( - vcpu->emulator, cpu, - &vcpu->exit_ctx.VpContext, ctx, - &emu_status); - if (FAILED(hr)) { - error_report("WHPX: Failed to parse MMIO access, hr=3D%08lx", hr); + ret =3D translate_gva(cpu, gva, &gpa, WHvTranslateGvaFlagValidateRead); + if (ret < 0) { + error_report("failed to translate gva to gpa"); return -1; } =20 - if (!emu_status.EmulationSuccessful) { - error_report("WHPX: Failed to emulate MMIO access with" - " EmulatorReturnStatus: %u", emu_status.AsUINT32); + ret =3D address_space_rw(as, gpa, MEMTXATTRS_UNSPECIFIED, data, size, = false); + if (ret < 0) { + error_report("failed to read from guest memory"); return -1; } =20 return 0; } =20 -static int whpx_handle_portio(CPUState *cpu, - WHV_X64_IO_PORT_ACCESS_CONTEXT *ctx) +static int guest_mem_write_with_gva(CPUState *cpu, uint64_t gva, + const uint8_t *data, uintptr_t size) { - HRESULT hr; - AccelCPUState *vcpu =3D cpu->accel; - WHV_EMULATOR_STATUS emu_status; + int ret; + uint64_t gpa; + AddressSpace *as =3D cpu_addressspace(cpu, MEMTXATTRS_UNSPECIFIED); =20 - hr =3D whp_dispatch.WHvEmulatorTryIoEmulation( - vcpu->emulator, cpu, - &vcpu->exit_ctx.VpContext, ctx, - &emu_status); - if (FAILED(hr)) { - error_report("WHPX: Failed to parse PortIO access, hr=3D%08lx", hr= ); + ret =3D translate_gva(cpu, gva, &gpa, WHvTranslateGvaFlagValidateWrite= ); + if (ret < 0) { + error_report("failed to translate gva to gpa"); return -1; } =20 - if (!emu_status.EmulationSuccessful) { - error_report("WHPX: Failed to emulate PortIO access with" - " EmulatorReturnStatus: %u", emu_status.AsUINT32); + ret =3D address_space_rw(as, gpa, MEMTXATTRS_UNSPECIFIED, (void *)data= , size, true); + if (ret < 0) { + error_report("failed to write to guest memory"); return -1; } =20 return 0; } =20 +static void write_mem(CPUState *cpu, void *data, target_ulong addr, int by= tes) +{ + if (guest_mem_write_with_gva(cpu, addr, data, bytes) < 0) { + error_report("failed to write memory"); + abort(); + } +} + + +static void fetch_instruction(CPUState *cpu, void *data, + target_ulong addr, int bytes) +{ + if (guest_mem_read_with_gva(cpu, addr, data, bytes, true) < 0) { + error_report("failed to fetch instruction"); + abort(); + } +} + +static void read_mem(CPUState *cpu, void *data, target_ulong addr, int byt= es) +{ + if (guest_mem_read_with_gva(cpu, addr, data, bytes, false) < 0) { + error_report("failed to read memory"); + abort(); + } +} + +static void read_segment_descriptor(CPUState *cpu, + struct x86_segment_descriptor *desc, + enum X86Seg seg_idx) +{ + bool ret; + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; + SegmentCache *seg =3D &env->segs[seg_idx]; + x86_segment_selector sel =3D { .sel =3D seg->selector & 0xFFFF }; + + ret =3D x86_read_segment_descriptor(cpu, desc, sel); + if (ret =3D=3D false) { + error_report("failed to read segment descriptor"); + abort(); + } +} + + +static const struct x86_emul_ops whpx_x86_emul_ops =3D { + .fetch_instruction =3D fetch_instruction, + .read_mem =3D read_mem, + .write_mem =3D write_mem, + .read_segment_descriptor =3D read_segment_descriptor, + .handle_io =3D handle_io +}; + +static void whpx_init_emu(void) +{ + init_decoder(); + init_emu(&whpx_x86_emul_ops); +} + /* * Controls whether we should intercept various exceptions on the guest, * namely breakpoint/single-step events. @@ -1279,8 +1347,9 @@ bool whpx_arch_supports_guest_debug(void) =20 void whpx_arch_destroy_vcpu(CPUState *cpu) { - AccelCPUState *vcpu =3D cpu->accel; - whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); + X86CPU *x86cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86cpu->env; + g_free(env->emu_mmio_buf); } =20 /* Returns the address of the next instruction that is about to be execute= d. */ @@ -1643,7 +1712,7 @@ int whpx_vcpu_run(CPUState *cpu) break; =20 case WHvRunVpExitReasonX64IoPortAccess: - ret =3D whpx_handle_portio(cpu, &vcpu->exit_ctx.IoPortAccess); + ret =3D whpx_handle_portio(cpu, &vcpu->exit_ctx); break; =20 case WHvRunVpExitReasonX64InterruptWindow: @@ -1990,22 +2059,11 @@ int whpx_init_vcpu(CPUState *cpu) =20 vcpu =3D g_new0(AccelCPUState, 1); =20 - hr =3D whp_dispatch.WHvEmulatorCreateEmulator( - &whpx_emu_callbacks, - &vcpu->emulator); - if (FAILED(hr)) { - error_report("WHPX: Failed to setup instruction completion support= ," - " hr=3D%08lx", hr); - ret =3D -EINVAL; - goto error; - } - hr =3D whp_dispatch.WHvCreateVirtualProcessor( whpx->partition, cpu->cpu_index, 0); if (FAILED(hr)) { error_report("WHPX: Failed to create a virtual processor," " hr=3D%08lx", hr); - whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); ret =3D -EINVAL; goto error; } @@ -2067,6 +2125,8 @@ int whpx_init_vcpu(CPUState *cpu) max_vcpu_index =3D max(max_vcpu_index, cpu->cpu_index); qemu_add_vm_change_state_handler(whpx_cpu_update_state, env); =20 + env->emu_mmio_buf =3D g_new(char, 4096); + return 0; =20 error: @@ -2256,6 +2316,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms) } =20 whpx_memory_init(); + whpx_init_emu(); =20 printf("Windows Hypervisor Platform accelerator is operational\n"); return 0; --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:46 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=1770789331; cv=none; d=zohomail.com; s=zohoarc; b=h3rEFaXu6YVSHALUtdiEgSKaEZdUSRW73esjKGxFCsqI44rLrgTDrogTrqIQRLYXFUJswl6ZxL2Xu3LhZdgmPxGNUMyZaNsRmhp0dpAy7zEiyJqH/bahgg1Ryl3iXX52qmnkSOWj1PE6smHld7w0yvYPe5sxIKVrSQ2MqDFp/tY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770789331; 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=9K8msZEsB74w5xUYMfu4xSNX/KrRn+3Zoq0itnJzfNI=; b=DpeGxpd5SZ4ANve9aEOd3aDqIvIzdVcH2Lcy1mGNQbM6xhvLaR+MoypfTxkQ/qbDqPmBPzQTx0u7e1sq5Jr4dM+Wr7dS1iE+qjHhXTQW243smKSxF+S62latq4TLTBIQfSmH2ozNEgeSofzvXWxRHyX1IE4w2Gi3l3sY+kgT0Fc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177078933073128.48572728908232; Tue, 10 Feb 2026 21:55:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vq3BB-0005ZW-VF; Wed, 11 Feb 2026 00:54:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3BA-0005YW-KA for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:24 -0500 Received: from p-west3-cluster1-host5-snip4-6.eps.apple.com ([57.103.73.177] helo=outbound.ms.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3B8-0002sO-V2 for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:24 -0500 Received: from outbound.ms.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPS id 4B83B180018F; Wed, 11 Feb 2026 05:54:20 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.154.37]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPSA id 3D3901800188; Wed, 11 Feb 2026 05:54:17 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770789261; x=1773381261; bh=9K8msZEsB74w5xUYMfu4xSNX/KrRn+3Zoq0itnJzfNI=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=AxebIELahx/MMkZGSuz0TD2rZVdkBkc+5Q/ZpGVARw4K3AnyoxVx9qHc4t9Q+6CLV2UNR4tft2ieTAKQWwtTsmSfPBsGOAyKoJtW63uGl93bJumaWStglqW8ATCh0xidcuFnI7QBZRvmoGiONKYoEFBPHBv1tiqZ2hxjyOq8vcXbXGA78doS1FbZeUKgAc/Fj2YuT8EmZuRDflp9Zi3Go+P7lmRMoXmRxk7LFYW22g38V7uwvBLMmOrWM/fyMu9SYhey+Y1RoWbEHgqkH9yNqcRofYipgwPGoNBHXvZ757yPOCIRp6Mnd/Un+63Cg0Fo4gXi3AXGHPLQom4wExI6Kg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Wei Liu , Roman Bolshakov , Pedro Barbuda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cameron Esfahani , Zhao Liu , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Magnus Kulke , Mohamed Mediouni , Paolo Bonzini Subject: [PATCH 6/7] whpx: remove remaining winhvemulation support code Date: Wed, 11 Feb 2026 06:53:51 +0100 Message-ID: <20260211055356.44664-7-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260211055356.44664-1-mohamed@unpredictable.fr> References: <20260211055356.44664-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=JvH8bc4C c=1 sm=1 tr=0 ts=698c198d cx=c_apl:c_apl_out:c_pps a=qkKslKyYc0ctBTeLUVfTFg==:117 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=UBzWkQmmy9v7-gCQCgEA:9 X-Proofpoint-GUID: AK2XfCVVFUg3ilFx051XlaWtgdqv68FJ X-Proofpoint-ORIG-GUID: AK2XfCVVFUg3ilFx051XlaWtgdqv68FJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDA0NiBTYWx0ZWRfX/n+Os9HYeVAU qFLtuaoNf3a8/sUN63M6TtuycKEJ3FX/gC0tAxw1EvnZkqvkVpD3yYWUeaxkXb7cWFRzsh160SY vYDeWD6DUUM0RiNZMrz0QLO6jOLow7rNoLSuILB5rD5obgmhZiXJ/leK52QqYrOZ7qGpxQEGRJn iICVpVDscECxD3IFE4O/YYVC1NQZgd8CGth4+aFke1H3pfR1L/lnwvHmLl4Zb5KAuR3OYlZxDpR oF10hER10lvaY0ckWBi16A7NhKxB/VmYeGChe8jZuBWNW+u1cgnvmRg+3rq/jbzj5EI2UbCOgsr QWcxBZh1QZIu4xVZieK6R38VBHuLieyYQOnMk/nf0QaJLHVH9mWFm7XWVvpT98= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_03,2026-02-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 clxscore=1030 phishscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110046 X-JNJ: AAAAAAABQEOqu9gaNY0a/SXBYrXUXFg+NeC4nr771PNGZjAoLTihOUFY/RQPaYwXYZneELujfHL0J1hWqkRUeWWYQkTLPJ+5fTRsbJ0J4U4thnIK/57P9uuiH/qx5A56xw1GQ7C6CYihsJQzIVpmePpQLgnKtIE6pLucSOyCC3P3u+5HUVGVo5l5iC8wCu/2AVilkbmOBrd5FjrdF2Te/0gyM+fmkmJdZDRVAi3rEJ6Qg1j70PSu+/zpVNKXXd1idk2jw7et4+4E8QRHOkJDHeEswLX+FBBFcdaxoCt6LXSJKkI09qA7d66rpoWJ5GTRdCdc2FY1yyLH9iYtgufissDFh5wu/4HC+dhuO08uke1jpmGLMUK6Z7WdasfUV0noaEP7tvbtb8N589PjNncMf0PeISEPrKGRkniQqSiihKDLRf7ji90twwMjl2ju5wbdWEDq2aJ3040NzXiR9VGsSbq4aFeStHWxg1f0ANgga13djfUR+dv1pu1y6U7Fpg8WPOwIc/a6xDCBYjtAJObUWNXDgI2cSa/ZQxJA6FX03As/eWijPVsL3/Sargc5W0k5/Zj2tpgZocrSI8Zz3yo6/tASRuuzg42ZeHarLSMtOAlnemzQMuBY5RrD1pyIQwPiyAs5DdIOsGMo2WRJwmy6Cd+MG4OKwf/K5QaliDyyAbPEBr89QsYbr1o6d/KPEVxxwTQ+96nSpdsYhPNpUc2Sqqm6/hNbmV0kJqvkc0vNvhmv/eyfhMgAsOeplwUrZW9kXdhLAULDOAP8ZpnCOwQX/TuSbYoRb4QS Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=57.103.73.177; envelope-from=mohamed@unpredictable.fr; helo=outbound.ms.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=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: 1770789334999158500 Content-Type: text/plain; charset="utf-8" After moving away to target/i386/emulate, this is no longer necessary. Signed-off-by: Mohamed Mediouni --- accel/whpx/whpx-common.c | 22 ---------------------- include/system/whpx-common.h | 3 --- include/system/whpx-internal.h | 16 ---------------- meson.build | 3 +-- 4 files changed, 1 insertion(+), 43 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index c2263c2496..245e64a12f 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -39,9 +39,6 @@ bool whpx_allowed; bool whpx_irqchip_in_kernel; static bool whp_dispatch_initialized; static HMODULE hWinHvPlatform; -#ifdef HOST_X86_64 -static HMODULE hWinHvEmulation; -#endif =20 struct whpx_state whpx_global; struct WHPDispatch whp_dispatch; @@ -393,7 +390,6 @@ static bool load_whp_dispatch_fns(HMODULE *handle, HMODULE hLib =3D *handle; =20 #define WINHV_PLATFORM_DLL "WinHvPlatform.dll" - #define WINHV_EMULATION_DLL "WinHvEmulation.dll" #define WHP_LOAD_FIELD_OPTIONAL(return_type, function_name, signature)= \ whp_dispatch.function_name =3D \ (function_name ## _t)GetProcAddress(hLib, #function_name); \ @@ -420,14 +416,6 @@ static bool load_whp_dispatch_fns(HMODULE *handle, WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD) break; - case WINHV_EMULATION_FNS_DEFAULT: -#ifdef HOST_X86_64 - WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib) - LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) -#else - g_assert_not_reached(); -#endif - break; case WINHV_PLATFORM_FNS_SUPPLEMENTAL: WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_LOAD_FIELD_OPTIONAL) @@ -543,11 +531,6 @@ bool init_whp_dispatch(void) if (!load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_DEFAULT= )) { goto error; } -#ifdef HOST_X86_64 - if (!load_whp_dispatch_fns(&hWinHvEmulation, WINHV_EMULATION_FNS_DEFAU= LT)) { - goto error; - } -#endif assert(load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_SUPPLEMENTAL)); whp_dispatch_initialized =3D true; @@ -557,11 +540,6 @@ error: if (hWinHvPlatform) { FreeLibrary(hWinHvPlatform); } -#ifdef HOST_X86_64 - if (hWinHvEmulation) { - FreeLibrary(hWinHvEmulation); - } -#endif return false; } =20 diff --git a/include/system/whpx-common.h b/include/system/whpx-common.h index 5bce33e336..fa2cc9a2ce 100644 --- a/include/system/whpx-common.h +++ b/include/system/whpx-common.h @@ -3,9 +3,6 @@ #define SYSTEM_WHPX_COMMON_H =20 struct AccelCPUState { -#ifdef HOST_X86_64 - WHV_EMULATOR_HANDLE emulator; -#endif bool window_registered; bool interruptable; bool ready_for_pic_interrupt; diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index ad6ade223e..7a1c9871f1 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -4,9 +4,6 @@ =20 #include #include -#ifdef HOST_X86_64 -#include -#endif #include "hw/i386/apic.h" #include "exec/vaddr.h" =20 @@ -89,12 +86,6 @@ void whpx_apic_get(APICCommonState *s); X(HRESULT, WHvResetPartition, \ (WHV_PARTITION_HANDLE Partition)) \ =20 -#define LIST_WINHVEMULATION_FUNCTIONS(X) \ - X(HRESULT, WHvEmulatorCreateEmulator, (const WHV_EMULATOR_CALLBACKS* Cal= lbacks, WHV_EMULATOR_HANDLE* Emulator)) \ - X(HRESULT, WHvEmulatorDestroyEmulator, (WHV_EMULATOR_HANDLE Emulator)) \ - X(HRESULT, WHvEmulatorTryIoEmulation, (WHV_EMULATOR_HANDLE Emulator, VOI= D* Context, const WHV_VP_EXIT_CONTEXT* VpContext, const WHV_X64_IO_PORT_ACC= ESS_CONTEXT* IoInstructionContext, WHV_EMULATOR_STATUS* EmulatorReturnStatu= s)) \ - X(HRESULT, WHvEmulatorTryMmioEmulation, (WHV_EMULATOR_HANDLE Emulator, V= OID* Context, const WHV_VP_EXIT_CONTEXT* VpContext, const WHV_MEMORY_ACCESS= _CONTEXT* MmioInstructionContext, WHV_EMULATOR_STATUS* EmulatorReturnStatus= )) \ - #define WHP_DEFINE_TYPE(return_type, function_name, signature) \ typedef return_type (WINAPI *function_name ## _t) signature; =20 @@ -103,16 +94,10 @@ void whpx_apic_get(APICCommonState *s); =20 /* Define function typedef */ LIST_WINHVPLATFORM_FUNCTIONS(WHP_DEFINE_TYPE) -#ifdef HOST_X86_64 -LIST_WINHVEMULATION_FUNCTIONS(WHP_DEFINE_TYPE) -#endif LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DEFINE_TYPE) =20 struct WHPDispatch { LIST_WINHVPLATFORM_FUNCTIONS(WHP_DECLARE_MEMBER) -#ifdef HOST_X86_64 - LIST_WINHVEMULATION_FUNCTIONS(WHP_DECLARE_MEMBER) -#endif LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DECLARE_MEMBER) }; =20 @@ -122,7 +107,6 @@ bool init_whp_dispatch(void); =20 typedef enum WHPFunctionList { WINHV_PLATFORM_FNS_DEFAULT, - WINHV_EMULATION_FNS_DEFAULT, WINHV_PLATFORM_FNS_SUPPLEMENTAL } WHPFunctionList; =20 diff --git a/meson.build b/meson.build index eeafd1d42b..970372bee2 100644 --- a/meson.build +++ b/meson.build @@ -865,8 +865,7 @@ if get_option('whpx').allowed() and host_os =3D=3D 'win= dows' endif # Leave CONFIG_WHPX disabled else - if cc.has_header('winhvplatform.h', required: get_option('whpx')) and \ - cc.has_header('winhvemulation.h', required: get_option('whpx')) + if cc.has_header('winhvplatform.h', required: get_option('whpx')) accelerators +=3D 'CONFIG_WHPX' endif endif --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:46 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=1770789342; cv=none; d=zohomail.com; s=zohoarc; b=b2jorwzjFyscXKJzjqaxM+jaXWa6BJPDRv6TJBRv6Tm0k9ydLI+Us4G5tnMHSXgO+n1l0M0Lq6KI9piLdLGvocP2z10EAcNZjcLM2KvaFy19GOYiQr1Mrgj/FBsuD4SVLiweO3XjcVViVCjsUTfRV76WcXXEOG4H31InfR2WTvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770789342; 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=nVjDYtb7PCOKFdIlhby6GZpS+ZwoSeErtfJVLQksP/Q=; b=M9AtNsO/bJ2FpkGu+sbO88D4aQBBOw37hLn/SQ/mwMg6ppdHE93ruX7Gs4Hc5x3jblpIbHBEgfsOTUTeN14QFfefGsDoTPUqBT32LOU0q5hgOKM71Ak6R3cqaVvmSxWlSdUPjFI0QhdROM2Fy9Taa5dse+8HPW/LMaUVJYgnYf0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770789341416704.3540751647264; Tue, 10 Feb 2026 21:55:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vq3BG-0005b9-Fj; Wed, 11 Feb 2026 00:54:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3BE-0005a2-S9 for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:28 -0500 Received: from p-west3-cluster1-host5-snip4-4.eps.apple.com ([57.103.73.175] helo=outbound.ms.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vq3BC-0002t4-8Y for qemu-devel@nongnu.org; Wed, 11 Feb 2026 00:54:28 -0500 Received: from outbound.ms.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPS id 7D4E41800188; Wed, 11 Feb 2026 05:54:23 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.154.37]) by p00-icloudmta-asmtp-us-west-3a-100-percent-7 (Postfix) with ESMTPSA id 4C454180019A; Wed, 11 Feb 2026 05:54:20 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770789265; x=1773381265; bh=nVjDYtb7PCOKFdIlhby6GZpS+ZwoSeErtfJVLQksP/Q=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=Qa5Gao/LQC4DFtLNWkp5RMalJVNI9wJ8ovdW7xuPgUJaY+ntxcISu7ifWcKjm2aI7jiPdyB56u+pM8MjXRIoFkUqYt8o+u6Taf4G81NPCQGlKuiavtSut6wF19BD8Bz2li6+tj3VdFPKr1C+XoNnUDEmN3m/WsBPnincrDF5rGlI641C3/l0t3MHK5ygx8UcmP67AqJ8vIIbuor1DdMwqOqQwPzlAMoh1sTCVFafpEVJyDrPOLFIKPmoPqfSxKqXyNh156jwnSnEqX4IXxYS38j6Z0umfsHuq//J9zuFQl5RqSZZad5C4iIretaU/lONvtBPpoRplK2FrkyjYmoKQA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Wei Liu , Roman Bolshakov , Pedro Barbuda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cameron Esfahani , Zhao Liu , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Magnus Kulke , Mohamed Mediouni , Paolo Bonzini Subject: [PATCH 7/7] whpx: x86: remove messages Date: Wed, 11 Feb 2026 06:53:52 +0100 Message-ID: <20260211055356.44664-8-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260211055356.44664-1-mohamed@unpredictable.fr> References: <20260211055356.44664-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: -C2SR0VYGF9YQCsjcpRfi5Y6nrjTN3r5 X-Proofpoint-ORIG-GUID: -C2SR0VYGF9YQCsjcpRfi5Y6nrjTN3r5 X-Authority-Info-Out: v=2.4 cv=Y/31cxeN c=1 sm=1 tr=0 ts=698c1990 cx=c_apl:c_apl_out:c_pps a=qkKslKyYc0ctBTeLUVfTFg==:117 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=tHCKdM3VofH7q6B9RbgA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDA0NiBTYWx0ZWRfX0IOrF/8Mg+7F mflHfme6OTfu2eqqK294nEVXDUd7fOn0PPyj7TmSnZXu/gfX5zIMrx82IEl/6sKp4wmX4m0YR4F Op8Iv8hkiOYKzpK0bjPoTNiHuLr1+DJykGjjZMmFfxumpFJ7IvgCPZpbO5vvga05nUuSlpht2Fm zqvsUbVOvRkDnQOW+MAtGS4I9VZxt8dMP3pAyeJ1vNdMmKwQUufchiP1Osn9foZRmK1HQQsqZqK ZJHDYqUJtZxWH7/lRZzYBrrDCJW8fbo9p3FoE9r6gfBOo4SnCuY9rColOXPtmISSxHPJpLAtYtj zO2BIwDkrhkYAHbAsjkO+5PkW9iD/wSzJ1d4W9SEFkVbCTWbJRPWDBjeCy8kY8= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_03,2026-02-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 spamscore=0 phishscore=0 suspectscore=0 clxscore=1030 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110046 X-JNJ: AAAAAAABBvniDOb4Sfxe1tXxKLzZ9uNGT2FNJqtTdRJ6xr9e5ViXVTOLwawPb5rb/YGu62A3ls/kpWLclmI1Tdw1ZcUhWX6GEN7e7QfksuFwdEFYKzbPPg7AOnIJllNL+7iu6vCC+EUCHu1h/NeyeP5vfE4ecS1p8yy0trxpf2yL1BLxdJBXU8eRghLJGu/DIDyxHdRDc5VMdOBMLZvyCPw16LhAxglWndWT7V4nRBi98w+EecUcEhVXhMWxVfMWKM7++X8AChR7GxXGh2Dp4n7zoVZkiDrbO6VmYiKQXnh8rq3EBT9nl/+MXuuveG4S0H6Zt9ahEWaGguZ1WrqBN0fJzYDuKKLn7UqNSxxUOgadntrQXfw3nr9gxfAn6UCf6vSFCg0glyEyMjLAR/k0FeNiUmmB+xF5N5fN8D/ebzX4fYxJC/9xOl0C+r4CoE5E6xecnsxi3RJgg7zMi63lbBnd9FSS+0qdTeYp0SGs73eeWlj7gkdDJ5JIXoNliuEu0c7hJySaUxp6TyFXLANC8jHjHZfynSLGc46Q0RMutwpq/FMuQegMpzuEfceQUcO5AhlFhSopwcGYbQGShVI81WkLaNU//Xqs8kvqOFhHODA2WIE9mro9YgdVqIhFBPnghBFHGCNYLq74nUv7XVtz40QysNyhH79O4UAhTZa8sxmpwnBSTxDEe2QR+IkqMqiTuEBOMYLBqcM+iKUpX0yTMTMNWMxt21mBXkgt61n7MNf1DBp8YiGIWRjtX1ws4diASRZN0TRQYjNzPs2ZQkdxG4+h/4pltwXnb7o= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=57.103.73.175; envelope-from=mohamed@unpredictable.fr; helo=outbound.ms.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=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: 1770789343939158500 Content-Type: text/plain; charset="utf-8" Remove some messages printed by the WHPX backend that don't have an equivalent elsewhere and don't convey an error. Signed-off-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 68ac9dd6ff..9877359274 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2244,7 +2244,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) whp_dispatch.WHvSetVirtualProcessorInterruptControllerState2) { WHV_X64_LOCAL_APIC_EMULATION_MODE mode =3D WHvX64LocalApicEmulationModeXApic; - printf("WHPX: setting APIC emulation mode in the hypervisor\n"); hr =3D whp_dispatch.WHvSetPartitionProperty( whpx->partition, WHvPartitionPropertyCodeLocalApicEmulationMode, @@ -2318,7 +2317,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) whpx_memory_init(); whpx_init_emu(); =20 - printf("Windows Hypervisor Platform accelerator is operational\n"); return 0; =20 error: --=20 2.50.1 (Apple Git-155)