From nobody Sun Apr 12 04:21:48 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=1770954407; cv=none; d=zohomail.com; s=zohoarc; b=CQWR2b5/+NlE7Hvttsz1eTegR8Ns+LUAR/+YH4wY5Zd/L3FZMK2JxEw6uJnTv2oUcJG6YkuVAcYXdXfbclMxMt0b5e6nOOOpq+T1pW5QJNYL8cLa0Yio+LnMEQC+9cLZZmXIY3f59tW3fW58yIEWBASg1+fbHNkJxohGvHXI5OE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954407; 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=pDdswD4Xub7IE+kNZc1mjsSEBI8ZIi+2CDn72stJol0=; b=V/vn0BtkqcCGfNb1RWU3H799HmDw5vVfCHKP454FTbobp2jmT9zOUPWaw3yEkWxU0UWvhAtaNmBBFKdWR2V1DKFJiP4EtzwXbgFfZpuoyv8ilkF4mYbfLiI7Ys5skMRVg2OEFUDK5QRkquxtyPR2jvFY26iOLmmMXAhK3sUQhgE= 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 1770954407174643.3437651011351; Thu, 12 Feb 2026 19:46:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8H-0008Eu-A1; Thu, 12 Feb 2026 22:46: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 1vqk8F-0008E9-2p for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:15 -0500 Received: from p-west1-cluster5-host8-snip4-6.eps.apple.com ([57.103.66.247] 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 1vqk8D-0005A9-0h for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:14 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id E1D8718000BF; Fri, 13 Feb 2026 03:46:07 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 60DA318000A3; Fri, 13 Feb 2026 03:46:04 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954369; x=1773546369; bh=pDdswD4Xub7IE+kNZc1mjsSEBI8ZIi+2CDn72stJol0=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=ILdscb1kM/tDeesmZbu2JvoMrZiS0o64WIk7RPh6HW0IjIKGRBvLCArBCjCMLrSF9tnrxOT6zxPyrYzrQtrLYNlHjuT0TEEj5XiYg2i69TBnQvFChDTf71/9u0kWkrgSr8eEJRnjcRnXNdtxeSNe+LkEa21cUHrsDvkmPg3ZEb4v2hoorl383xEjwJaBJqbd+aCT8n9ZdHWMUjoAq9f8IJE93LF3btCs9rK7YRJhpJXOigdqyMYuKohr11X57I1shXt/Zyu9XFxde0vYtYnS9Jr7ovZnqTS34Usyy9J5jrTeJGXhQeuPqKpLAFe7uaZ4xYujaRRyUAQk4I6EVk1MTw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 01/10] target/i386: emulate, hvf: move x86_mmu to common code Date: Fri, 13 Feb 2026 04:45:44 +0100 Message-ID: <20260213034556.13471-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: WEGHwlj-INwMP_fB0eqnFiPfO-aklu6P X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfX0DJurA441ZAe sbIrYarwS0b0oJC+w7q4/AJ4XCfjRH8TbVpJ1AEbzHO5/tD1uxKc412C//ZoDGeCcAYefYi95XG q6aIoKyIX/6m1LsIgxOp82sGW2YWyz2DBmcbcz8N6+d8zO6BFNYKGmNLM8OAJii1i+VU1Gu4dYm 3TFGkTir5Y3AeG3waRCfE+QsWW+fnnniTIAL3lJPmikfjn9egLoXupDad9OzFhvgPrCDCXkqteo v01vPXjDF/eX87NiJwmTYzG1e+zaEcx7unrSP3VIJntBr6TDNEX3hGe+EOIF5OR0e0s0q0Kk+tq ub0Zxi3URbTBFYKHM4w9OoSFyFoDovWJmz/bpVRS/kz5dscSkUZdqtleU2YN3o= X-Authority-Info-Out: v=2.4 cv=Lv6fC3dc c=1 sm=1 tr=0 ts=698e9e80 cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=j-fo9BjxNM0Z7X-A5OoA:9 X-Proofpoint-GUID: WEGHwlj-INwMP_fB0eqnFiPfO-aklu6P 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 bulkscore=0 clxscore=1030 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 suspectscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABJf74yhZYx7mDBQ8nApoM607M0KqYPKSlsvqJIAw5XWIoxJCHy2R0r3Z9ZsN+c8XCZVBVicLO8QqbfBCsy4g9qhRSFZ4ESqVtiXKWCttzQtNV86hw1HKwkOkSHhWCdX2NXA2YC/shHbOAEZvmxl+vjaB71I83q+w9xXLwDUZA9qK+3XOudaGAqB9rt26EuPRnSiqU/O44mqeHwbWCp3bPNEQIYHEX0bOq6FqZoT0448VZ5YFyVTsgLbQpFdetixJEnbrrGCVCFHTtmIzX+qxLwfNcK5I0QFt92U/ihrOed7m6cVuos98iT2NJJgnoaZ5fxH+hi31oWlP54aj67vRSjWfTd1vKLPzb88j2L/NKzVtHrnihiG7FDp5WUfn6nMbBO8f5BycXBvGULUgZmnihfPBaiQo/4aGutVv0DwfHoJxTDCKLuMm0kGmfKzdzQRJ+YKfCgT+5cKYpTKObbtGgraG8Db/es0G9g5gFV+oEDGW5N1VHfxQ2BICaRUZgxWQI5xV/Gsw/y2muxEwnPC/WxYt4Zo0w81o/9T+WOydce79xH2YJ3K08uAGWnAdpa6ikv3M7QzARhJFWy0oEgCurPcx/57dnwo0nUXbZCzphH0ELOYNVzmySNcR0Q78E80i5FVmCaqXzaOG+zQ7pZri/AlrPtJTXMc7urwUslA9SCL/ZgVhJ013JCDylPDiRStt3IVfjgNi7WPUCjJqgvxJ+HPURLy/ICn/H4L9K8XR7B80G5JokECSnP9WnM5RgZXpPM9ayYG1iNcqguw== 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.66.247; 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: 1770954412849158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Bernhard Beschow shentey@gmail.com --- target/i386/emulate/meson.build | 1 + target/i386/{hvf =3D> emulate}/x86_mmu.c | 14 +++++++++----- target/i386/{hvf =3D> emulate}/x86_mmu.h | 0 target/i386/hvf/hvf.c | 6 +++++- target/i386/hvf/meson.build | 1 - target/i386/hvf/x86.c | 2 +- target/i386/hvf/x86_task.c | 2 +- 7 files changed, 17 insertions(+), 9 deletions(-) rename target/i386/{hvf =3D> emulate}/x86_mmu.c (95%) rename target/i386/{hvf =3D> emulate}/x86_mmu.h (100%) diff --git a/target/i386/emulate/meson.build b/target/i386/emulate/meson.bu= ild index b6dafb6a5b..dd047c424a 100644 --- a/target/i386/emulate/meson.build +++ b/target/i386/emulate/meson.build @@ -2,6 +2,7 @@ emulator_files =3D files( 'x86_decode.c', 'x86_emu.c', 'x86_flags.c', + 'x86_mmu.c' ) =20 i386_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: emulator_files) diff --git a/target/i386/hvf/x86_mmu.c b/target/i386/emulate/x86_mmu.c similarity index 95% rename from target/i386/hvf/x86_mmu.c rename to target/i386/emulate/x86_mmu.c index afc5c17d5d..7d069a172a 100644 --- a/target/i386/hvf/x86_mmu.c +++ b/target/i386/emulate/x86_mmu.c @@ -19,10 +19,10 @@ #include "qemu/osdep.h" #include "panic.h" #include "cpu.h" +#include "system/address-spaces.h" +#include "system/memory.h" #include "emulate/x86.h" -#include "x86_mmu.h" -#include "vmcs.h" -#include "vmx.h" +#include "emulate/x86_mmu.h" =20 #define pte_present(pte) (pte & PT_PRESENT) #define pte_write_access(pte) (pte & PT_WRITE) @@ -99,6 +99,8 @@ static bool get_pt_entry(CPUState *cpu, struct gpt_transl= ation *pt, static bool test_pt_entry(CPUState *cpu, struct gpt_translation *pt, int level, int *largeness, bool pae) { + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; uint64_t pte =3D pt->pte[level]; =20 if (pt->write_access) { @@ -127,7 +129,7 @@ static bool test_pt_entry(CPUState *cpu, struct gpt_tra= nslation *pt, pt->err_code |=3D MMU_PAGE_PT; } =20 - uint32_t cr0 =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR0); + uint32_t cr0 =3D env->cr[0]; /* check protection */ if (cr0 & CR0_WP_MASK) { if (pt->write_access && !pte_write_access(pte)) { @@ -179,9 +181,11 @@ static inline uint64_t large_page_gpa(struct gpt_trans= lation *pt, bool pae, static bool walk_gpt(CPUState *cpu, target_ulong addr, int err_code, struct gpt_translation *pt, bool pae) { + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; int top_level, level; int largeness =3D 0; - target_ulong cr3 =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR3); + target_ulong cr3 =3D env->cr[3]; uint64_t page_mask =3D pae ? PAE_PTE_PAGE_MASK : LEGACY_PTE_PAGE_MASK; =20 memset(pt, 0, sizeof(*pt)); diff --git a/target/i386/hvf/x86_mmu.h b/target/i386/emulate/x86_mmu.h similarity index 100% rename from target/i386/hvf/x86_mmu.h rename to target/i386/emulate/x86_mmu.h diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index ce54020f00..9c5d85453d 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -62,7 +62,7 @@ #include "emulate/x86.h" #include "x86_descr.h" #include "emulate/x86_flags.h" -#include "x86_mmu.h" +#include "emulate/x86_mmu.h" #include "emulate/x86_decode.h" #include "emulate/x86_emu.h" #include "x86_task.h" @@ -254,6 +254,10 @@ static void hvf_read_segment_descriptor(CPUState *s, s= truct x86_segment_descript =20 static void hvf_read_mem(CPUState *cpu, void *data, target_ulong gva, int = bytes) { + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; + env->cr[0] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR0); + env->cr[3] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR3); vmx_read_mem(cpu, data, gva, bytes); } =20 diff --git a/target/i386/hvf/meson.build b/target/i386/hvf/meson.build index 519d190f0e..22bf886978 100644 --- a/target/i386/hvf/meson.build +++ b/target/i386/hvf/meson.build @@ -3,7 +3,6 @@ i386_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: file= s( 'x86.c', 'x86_cpuid.c', 'x86_descr.c', - 'x86_mmu.c', 'x86_task.c', 'x86hvf.c', 'hvf-cpu.c', diff --git a/target/i386/hvf/x86.c b/target/i386/hvf/x86.c index 5c75ec9a00..2fa210ff60 100644 --- a/target/i386/hvf/x86.c +++ b/target/i386/hvf/x86.c @@ -23,7 +23,7 @@ #include "emulate/x86_emu.h" #include "vmcs.h" #include "vmx.h" -#include "x86_mmu.h" +#include "emulate/x86_mmu.h" #include "x86_descr.h" =20 /* static uint32_t x86_segment_access_rights(struct x86_segment_descriptor= *var) diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c index bdf8b51ae6..b1e541a642 100644 --- a/target/i386/hvf/x86_task.c +++ b/target/i386/hvf/x86_task.c @@ -16,7 +16,7 @@ #include "vmx.h" #include "emulate/x86.h" #include "x86_descr.h" -#include "x86_mmu.h" +#include "emulate/x86_mmu.h" #include "emulate/x86_decode.h" #include "emulate/x86_emu.h" #include "x86_task.h" --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:48 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=1770954413; cv=none; d=zohomail.com; s=zohoarc; b=ii167iR5skAR3ejkFScblRUvxl4YZ/bqPL7NhpDnUmuFuJ1hcYSW4it1Z/iRvzzLRxbUym6pKM0kgRom78FYCKgET6NJU15WAPCnWDILTjSG5ExY1JpCWHpDjp5MqpgQp0jBr0BNSMvmmzeUfoenUokQpHyyywP4lXioeenjRKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954413; 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=IgY8VMJyPLvbXhXoXL0xKBc6rfpKXwlFUmqQu0MK3S+UB0hMdV1aWajbnEg4nNTnB2+Qq4hf7H8V/nGbEMD/EFPM6tMsFjShGUiYPLx84eykLedQMI15fcPTY4WXlkYSP0Mrp/HMhIZhwzTgtC2BBldstATBZ2OjAivqFTPTpd4= 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 1770954412502849.6692256781981; Thu, 12 Feb 2026 19:46:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8I-0008FH-H7; Thu, 12 Feb 2026 22:46:18 -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 1vqk8G-0008ET-89 for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:16 -0500 Received: from p-west1-cluster5-host6-snip4-10.eps.apple.com ([57.103.66.151] 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 1vqk8E-0005AL-FR for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:16 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id 6AB5A1800104; Fri, 13 Feb 2026 03:46:11 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id E49CB1800135; Fri, 13 Feb 2026 03:46:07 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954373; x=1773546373; bh=mOYNtTveKjr+KZigxP71eIiTh5kyqDuwACrDmj+VmsE=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=JJEwWWSq3syIFgK4RBQlhXt+Dh73qUMuQwwF7DKU/w7CWAvXLKMZGJmGHbgQ5fku7ehyWtfvP0rc596Brg1zSivShkqA0b9dg0CkFKaDJL6KsZorbwp9ZTBnp0M2jgcLEf4z9W9McnhlIsKJugnKhufVuo+CxYUHR3aJuwgwUBnsXskkUmxpfPaShdb5w6WKWHk4F9pUZxf6SBsu0V/RVidt7h6tHeiz5tQ2dY8BEd/fC++Aqg/yxNdEfCot/fQPm7hBxqHk6QfUJ25gHoA4w3atzYIr4EGNYSiw50+2SgyQu+XzF9mGpKfFV+AkOmvSR0Txl1rQb0ImEiN+Pxo5KQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 02/10] whpx: re-enable guest debug support on x86 Date: Fri, 13 Feb 2026 04:45:45 +0100 Message-ID: <20260213034556.13471-3-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 7Bdch6XXe5ToAIUFipNn4Igp9tqsiPzX X-Proofpoint-GUID: 7Bdch6XXe5ToAIUFipNn4Igp9tqsiPzX X-Authority-Info-Out: v=2.4 cv=BtSQAIX5 c=1 sm=1 tr=0 ts=698e9e84 cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 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-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfX7GynOkYCn4nP sddzfRnREd7/3oDZr5iyfNNcM1gQmTHsdnNVNO5NCa4UlufT5mifmSYl9xiTF9P6uYxnLcYxGwm etyWq0LGVn39ya57VrE9MiOL/Z+ZvMsoFYkNO/s6voGqeqjeq5VW1/bK9gOGhKBFRiG6wbkLPia xo0EgG1mfnT24y3NbFZOpF6O/Nmp+AIjwpU69iGC/uW6TcgIYm68A+6wEqDm9mPAoKlNwi8OXHM CMt5jH/tPdGwtHEKsoZAxD0ZUyjxXpZWsMghBg5pSPNPWgDE0HNAcrj0Xz80VeDiac5tsRYv6/o mWBo1zr7/YAzX3DC2klCdSSK0kgA2JuimvCnjlasgHM0JSe1uZkoNKpbQ97uys= 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 clxscore=1030 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAAB6nTUR1xGXANIy01QQin19GDRyc/xZhL1XDkr1YdJn9EOeHeg16kNLA8k42hHtByUtGC58jvfMZlBsWS7YzO5YTqaH1NWI37eR4I6/9udijsTrx/3UfqLwlu0CmW6MD7+LTJsZNp2XGxLt4JQel8pwORES1g8wbwS31w7NI/yA9Onoeo91cXpQr2GyVCsmfsaAzQPY3N7og0/muhdYARnxvWsr72nnRipARzmixHLLbM5dlMOFiCoPxd2vDUvtNXiTQrkEM5Uo3gPVQQ5czM8Wb/vpxx6StQPXW6nVLH0NYF9l8tA4ihEccIdTXVlnyBM8MZ00RBr7BE2CkvGJ5teE9Wq+M+A+Ub9GUOWQH8KHEIMDbQ7eRUpUA8PvNBj6slpy8AxDldoH+P1MKeFgKOZLemJz7FaBnP3h5ESVsHmRHa/YrAibMYdWiVPnVqUWJ9RT4J7S8fYRANHAJHNMM+0fLvHoT1o5GZWFvHwGa6ZSoE5HsYNRcGF/RMcz9yjb1jqLS3gZQn6Agmqh6p8brhgPygDFZsLl0lPJovyd7Q9d/ckZd9jB2tW6vEFs3RVVQLwFk4TOeRWhSZGfwqQ79UES/lSSOseE8LpiAjT4K4l095uho4cjwi2i0ftQKKAlyZaXA+9ayjwxLJMWUD4qY4C0Jc9KOLJ4spD1rW+nvgkBgFRVK887en2OYt4YxToeWQ+uRR9ui9RyPmM0N1mZma7V/yjz+5L4JsuuPTlEpy3Ws2Cv9lnuw8cz3wb+4DVbMS9FQabxbWCCk02leZ9mXhggWMfu05dkdva/bJVtqJH6w== 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.66.151; 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_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: 1770954419265154100 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Bernhard Beschow shentey@gmail.com --- 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:48 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=1770954479; cv=none; d=zohomail.com; s=zohoarc; b=enNmSvDVUmYXiDBpBLcervgdR/njxlndD4eph8RW9q/HIGfJQdTRfKD4rI8jU707ooPPWnkdFKrJJqwbxsw9+W5NKL1jggoCLpj7J46hpNNz934OV9gFTid1Voj6aba1JCj6FbVI82TeaADh/bwDoWb2ui4pZiS1wMKZcDYtF7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954479; 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=GNA62UqBDb6s1109taCPLp874JlS1AA37xrsDtsBC38=; b=BmPINlg34YEfAE5c4GwujtjGFp8FyY3yaCo7QbM3RPlGMm0Ga0sfc87mzU9XtF83B5BYVgNOCsOuyWX8tRhf7TKjCPtwQigsyM1bhi5zUKe7Yx8zRgYIkKMOHIC2PMMgh+YrjoweMAIl4lS0dXIoJLKvSlPq0Ct2thFMVhlbFsc= 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 1770954479049272.11271213758414; Thu, 12 Feb 2026 19:47:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8L-0008Fp-SY; Thu, 12 Feb 2026 22:46: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 1vqk8J-0008Fc-Rs for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:19 -0500 Received: from p-west1-cluster5-host8-snip4-4.eps.apple.com ([57.103.66.245] 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 1vqk8I-0005Am-6p for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:19 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id EFFEB18002C2; Fri, 13 Feb 2026 03:46:14 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 745CC1800108; Fri, 13 Feb 2026 03:46:11 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954376; x=1773546376; bh=GNA62UqBDb6s1109taCPLp874JlS1AA37xrsDtsBC38=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=J5iDv1YSeXFRcw8de+X/JHZIQLcG8xtWPxayWcrs9wHcxrA8343vQ+lF3lPQFYE+MopdK+Eyi6HP6II4EdGQ+BlK9W+E10un1BVLl77mQtRow3Lpt0PK5+PUq1s4xplk+C8bylev246gdgAO/crhAgD/jZt8lqjZyb7DF1enjracmMmcJqG/xT6Md32W3zDaaWn/V/je3bF6nFjxtcbtXSsUYr+wBN9tiXMnD9FKdwPOsXZ4MwJI3xbNZ8iYoWUqIl3kF70hhsiW9Kfb5IZSoHVObx6G6qAHKvq25IOTcCjVX7j77gOqEvv6DRfrImuU5loYK51oeZLFkOSuwCnWdQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 03/10] whpx: preparatory changes before switching over from winhvemulation Date: Fri, 13 Feb 2026 04:45:46 +0100 Message-ID: <20260213034556.13471-4-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: isyCgmPFDcY_YExf8hfh1cIL9sdmMrtI X-Authority-Info-Out: v=2.4 cv=DMGCIiNb c=1 sm=1 tr=0 ts=698e9e87 cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=qtJoQR36IQ-qKrO0xoYA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfXz+Kgd5PWV7ao 1uO2xFWDtvqcm87wjaBRSRDh8O5Sr0tIzk0OFGhxAU88x30yjDvCJDEVblRP2akXsV/cUNqozLc Uy9wcRjFidONmJYjtqC2j66iltAvu85FlhSJCruUEd9v2CT2VkbOyJvg0V6O6pFDAlPDM5ijdCv Dmh3S7AjyraGUqCHR0aNbCSA8HHeAVVEtw79zz5Tg0Kd44aOyVQEuO73wMZX9TYFrUj2zjeztJr 6KM1XiZY2b1E1Q03kY6/coi9i51psrkrsCohCCmkmXySuQ1SqKGX4Kruq2MdH7bbJfEpkY2SVjU s8tFv/fpGQ9S9p8kaQXM12ag95xWy40kDhIyYkCRrUn3+2KTK1Szd8XXL3KXIQ= X-Proofpoint-GUID: isyCgmPFDcY_YExf8hfh1cIL9sdmMrtI 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 phishscore=0 lowpriorityscore=0 clxscore=1030 suspectscore=0 mlxlogscore=944 bulkscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABJug8stYcPSOwBELLNAJdG26T/GzzjVD200pfmTB8WEu1FBe2eoNGGZ6O5Vzq2x+O1VTecTrx7Twhb1NE2VR8Jo/8SEynK3UFlV/ryGuXnzissIcyCfrSrggmilxCVI29zkWvKzTDGFRtl0uWN72afpE4RYuFFoJL7jeKN4UgRI9nYiOG1ouP6cU/jiD7vodAenxkpu2wncF8qCF28Bzn0dzzFeMnwP9WALMwt3OANi69CL7RVdGHnC9RPUcjJma5zk7hVfY4X/GPhjfiBOnSvLrI0d/GaECSzU31+igMs4kQUau2ZjLw2aVaYLIiZTHXhmL4tN6sEj74Dr9zfggfyteMqM9gDF2C3ouXL1y9iuA9KqxlEVUi0Y32Ne468axW0OxEAVEQ6xGym3dWZT3NbS0MVWTICH1Uh8hw393695OVA2TrEMRMNDOxezgQpWODXyMPL8fwyHT//mVrGxvLp7jKo7uBYadXVmDqTdsPBQm2QGwX3urS8JyFDMtS0qhKM+HrIT0HELjvtKVXRvVeOK0RVq6//IiGB0+P0XPjQmqGYc6J+LaqJbyyJWhFm8ypOoFcrkB60/dO3bcCsDYLqEQ3RWnnN9CZU7LqBis1lelkZnJlL4UlUh0XrJwRqYoZJz+Ugm/x3pI7000XMPIPUSDkGiUqtriZubMXs+PTrvDz96teWHTdJsoYPokDL0PyAtDQ4PHxiPFhygBfw1xvIcYHiy7Exy+finyDBR1WbDUJV6xCppebtAAAL3VvxHK5wbaWmQUPC20XPHVNrwztUwEr/w2Za7Xd7g== 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.66.245; 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: 1770954481280154100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni Tested-by: Bernhard Beschow shentey@gmail.com --- 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 dd047c424a..1bb3516249 100644 --- a/target/i386/emulate/meson.build +++ b/target/i386/emulate/meson.build @@ -7,3 +7,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:48 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=1770954413; cv=none; d=zohomail.com; s=zohoarc; b=c4i2GS185Hs+xtzEglv6BOHhAOAfoyJhlBUyn2jRzILoPzRJ6uuoHbfEVeFpcO56u44ObpqJJNVn7Xt+Iy2lSmMdAa9A72blXR5uA9gWsqGdfjXFtkvpo1/ALJ4UC+tZsxhhRC0Y3VskPkQIABbN+T3fGqGl62YloMb/B+GIkWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954413; 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=kl7BLIgoHCaLN73M2h01XDdhqFHEjdhE1+9YCBNwzPUw8xPbgagKvjtVy+/fInyEyqzM8IP5AMaUF7bd+zn2Eww9I0CULg60NbmvoCP2ghMx9eNfZHndJWG5EtOC3dCaR2i5fXw5RqCxG25i9wfhYlQzyBCCPZpYD9yn+HD9DYc= 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 1770954413084827.1948206147171; Thu, 12 Feb 2026 19:46:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8O-0008Gm-Vd; Thu, 12 Feb 2026 22:46: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 1vqk8N-0008GC-0t for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:23 -0500 Received: from p-west1-cluster1-host2-snip4-6.eps.apple.com ([57.103.64.79] 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 1vqk8L-0005H5-J2 for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:22 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id 79B6F18002E5; Fri, 13 Feb 2026 03:46:18 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 0416318002DE; Fri, 13 Feb 2026 03:46:14 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954380; x=1773546380; bh=SzPbZCaUO3NDYpRGPHTDqVjE5jH4BjEtis7wSjOSTkA=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=d78ypU2tMvmrkuxH7ZWJBS96kOcoJRhGsKNVyQV8+oCF4d6zZJzjGPkEsrwagkJQEUPpkYA4tJPY0ZX6IGXscmuOOH1wIgKxCOdQ1pSeByd86Ud1HVP+X69MKMgCaY67wzsuJgYPS3fXyXls6+9md6cs5AS1X0snL/6k8GdJZzKJT2z8YD9PVTsWPYPE6GTbVIsNNTgOsHoB6AYhOVMEjtWkieSPOrUuisd498n2lhyi91tYf/wYc7PZrG9B2bj+SxFrzC90o89hHYlg0dPBVuRZG2TZ3sYZywPjnH8+xyN5zDW7/oZ40J9gf8zRwhclvChC3Bc5c/J+e80Di6oMxg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 04/10] whpx: refactor whpx_destroy_vcpu to arch-specific function Date: Fri, 13 Feb 2026 04:45:47 +0100 Message-ID: <20260213034556.13471-5-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=M9ZA6iws c=1 sm=1 tr=0 ts=698e9e8b cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=MnziPJL1nimGiMRD7rAA:9 X-Proofpoint-GUID: Oc3yBaCx--Pz9_rryhIw1UHXUZ7avlc7 X-Proofpoint-ORIG-GUID: Oc3yBaCx--Pz9_rryhIw1UHXUZ7avlc7 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfXzFQX6LzvvElc EnT9SU5XGGQjxDxoR6sERWHtIdZI1DTLFhY4FXWDf0Zz9NQQmAvF1mZqh+ZswmGUGfJmRJhVMLy rVo5gFwhnmoXUkcg9IkxznGjCVCY7SyOWx16h+fNAKIkhBf8oEoOIjR+afNowpyFcuFwllpScyf yL5MHn9JTtViBH5OIPJvT70eSjjqP7fDns13Sbq75aAjaA/0m4Wivp6FF6FJ/JmS6pXe+x104+R BOJtYnKLl4Ohc54kRcLVMMqWUFG3Nf0fk2DWANh+zjMaqwQdkWOBQRYOxECoy+Atby6JTQfOer+ AYC3XwpZZa3VZa6LQSna+na3HVb0esXVXp2K+iKlsDcNJrrfie4qerWbk2EhEQ= 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=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-2602130025 X-JNJ: AAAAAAABsXb4p8zMp7cYHXyCcRsbgKtCvA664Nev4tN/D58+5lCE25ht26M/r4tNzxgeytYNjdDmxi08JwOD4hdD8RDJxDyD0721oE3HWmM8GmB35A4PF1Su0dIVG1BM4jYwuytX52R1LelLQM+6AkGhg6HBfUZ16omySiPTzFxSdoPQFTWUo1SvZ4AU/lb4AxdH6dEHJQ2qJ70JIJdxcVBvSm6H1UAmKg8fPd43lHkaDPqUxBZ5uM7cGKgWmUWWZ8ix+Za5uMp8exu8ATmrrvc/zEGPJS8tsQHcOvLa6JvrCXTooycax48lg16iPrtKHJ7GzBU1PUmdNzdNst9iaG7XF8c4dejpM+vx5wVbcG2MRzrpioSjLJPTv5UGneZgmBV+s+6s+GMWU6WGHSlsonUYt2iuDdNaCL4SAoXKnqCxsv6ncN6ig/YwDEKCI8cHK2DyHnH7P+qjs5kq7Z7JdlzDb9Bb7aPtTdHuwIZZy4gOF960TrJ65IWNBWKPiEyke2od5IZCiaLo6auZS8Jxv8o9XEACbOK0bki4EImK0lnQlEHmbnLEmnQg3vNy3BNvRJU/ugJewCvXJTt55x5bEQTa0bklsz942UoyQVH9tsF60DYP14T6V8Uj5hnGBb9vn0OFEv467T0WFXo1tmEKUS41MAV9l9fc5PBligpjfA7g8vI6veidaKBQ00lTgG0KxZ0/Xfx2BhXASWb4SRjlZLXvsm1kBEu1fikTjNp90T5I+xPDbgmbuvnmhGXxHjn1WaRv5pWGXJvSFrAONzykia+GvDWWvboxWfdUBjRj 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.64.79; 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: 1770954415226158500 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Bernhard Beschow shentey@gmail.com --- 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:48 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=1770954431; cv=none; d=zohomail.com; s=zohoarc; b=nCe5IwMOALeH0X3KtPwXbPu3M6PNWNPCjYkjSqYqDQhHgLVKGNKUBZmNiOhIZVh6ASyOuiaKTN4shIKBizAe3zABaO4cEY2i4qS4BKiJmBNPC5P4r1BVkj6kLmUPha8ZLFz/NqXwInwoWYjtSP8JAQd5dbn4o6DyuzSvxacaZwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954431; 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=bR9h5M9FNBfnpO0xlmYNC5N3lbfmGxCC0WGoFZSMdwYFvmwHSGMKJPmiNh6sYIuaJdvSZANwOf/x7nSi71oL3SSMhABF0AzN+dx0HAk5diXJMksNabdhJBY9izeAxRC7BJQrzc89aLVPSwAr2MkfU29IyoSViyMYwECShUqVG8c= 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 1770954431726352.11444934655833; Thu, 12 Feb 2026 19:47:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8R-0008H4-Kr; Thu, 12 Feb 2026 22:46:27 -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 1vqk8Q-0008Gp-Ez for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:26 -0500 Received: from p-west1-cluster4-host5-snip4-5.eps.apple.com ([57.103.65.236] 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 1vqk8O-0005N3-Qm for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:26 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id 08C0218002D0; Fri, 13 Feb 2026 03:46:21 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 8A20B180009E; Fri, 13 Feb 2026 03:46:18 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954383; x=1773546383; bh=be0nJ130zvvK9XI/bsScdXF1W7wGDBAIgGEUgggxqUo=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=FKnzeCtpexctX61PshjrHApKNvROlo7wBjBMGdEWUDtR8qPSCZCqON6Rw7MQhuZ3mk/6iitqyUmyXUoBytXO3/ClTcTcxYOU6tk+d+wNQvd77tYU9Gm3tw79mDBNFURlxX0xk6uj+6t2g+3Z7GkZlLjLflGtg1bqu8x8cQzmYgxU+5dijH8PiYzZ3X+RB29l4sMjROPsc9ouIy1WXQXKXZnoCJ1/YDE0h9uIL564QlIfmdaFH7plpf6FL38FABovJn7Ttid0a+SQorKvJHp/1+kTGFnvi7IT0QMGo8xPav/H8kvbngqRYjNtakMjm0fAH0bkT784uNJ3yp0U5clfbw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 05/10] whpx: move whpx_get_reg/whpx_set_reg to generic code Date: Fri, 13 Feb 2026 04:45:48 +0100 Message-ID: <20260213034556.13471-6-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: VBiiheajr493pI2umY_Ygn5mD8bRoSI- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfXzvqWZorHAYls NMsD3d5Sj6EeGWkhhn29nQeidsMsKaYxmZJqbpmFmPEcBFjO9QA9CEBcK23ER+ynCEVrk6MQIAs wNaRKMGBZx+UleeKtkP1uHJAnkAWSAGcVeGF6Xxy3u3OmOIZh90vRu2dFkhgz/bEYVbMMGz9kvq ebI2ryN1Z0czpc+44O9YbjKrLncaF0cupEwyk8c5PcnL1dL4PvQ8z5nPwkvt+4+HgnYnDYYnyA3 nboOf/h4Ts8g4Ygt921eaRGAqaU/F4FMBfYS1NTgaRnK9NH+ohpF8jJXhJXADwRtAWxoQ57d1/T B9ZvT7B4XiLImZNNLoo707smoffeFvG0acRjr7pyPzLwdkHnx+VX4T7GnEWRAE= X-Authority-Info-Out: v=2.4 cv=Lv6fC3dc c=1 sm=1 tr=0 ts=698e9e8e cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=zEEq2qrNK1eH_SHa7C4A:9 X-Proofpoint-GUID: VBiiheajr493pI2umY_Ygn5mD8bRoSI- 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 bulkscore=0 clxscore=1030 lowpriorityscore=0 malwarescore=0 mlxlogscore=990 phishscore=0 suspectscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAAB6Muo0EbYD4eVr/seCyC9w85rfUxv3DHLbJwmpJQ0x1DmmoFgfz+zXbuDYMCFNfB6tYCdWMrz+X2eeC5BVlSh2lgKEfBMD9b2PB411ZsXVHCVpuyVFH2OQrR/Wotbwdue1nNbu9jhomU0CUJ0K+pMANoZfVfZ9UK1TXy2QO01Sl92lwtir6To+R3DnElg67JbqEndfzo8V6+daNGdaKZoFeWR1hP0QR4gyeTehrQltwtJG6VouCRvqDA2NlKoajDA3GAb72Xc+MJ9qrUpU3dgpGCmhJV+pmFPP3AqXkviIHifYjV4/bzbPbhxTpo5rvkam0BwjcAgYjlgnB1VF4hRnqKydtujYPllFVxzdVRvYx4GedS4gwXrtGO399rM/egNrllza1vh10M3Gd0evqLuP0hNJXmi0OqPjcuQ/aCYwlzBmwIMgqGEZ8Si3R+UZ/1ApTHLIJnrt6mWkzVqlm/QXmIjasnJgAS5J8LYyu6duqRObLg44+r1p0pZw2gkHA9VCZtpc84Rpw/4ehMrrAU/OjDZUlZhWTVzfmF3fubNjraU1UXMv4JCqyGPIKB8HypNpAddTvAWzbFiJJGt8iEpZ84uSNVHWB/y4Q1tvSgQTQCKP3Cjl4HUVnvZ12A+KisaK/dR8YuJ5nPMLM/S179WIwvDKd+7MUFPrALUMmIxNsRPoIlN4NK8hAEZWMuUYswEkHYbAbRe1X3UGfYGP7X8R/GD+N4AjBu+ma6Q3wS7qu5KO6mPAazuIzF7yLOy35/zQ3wvH9OWAw== 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.65.236; 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: 1770954434705154100 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 Tested-by: Bernhard Beschow shentey@gmail.com --- 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:48 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=1770954444; cv=none; d=zohomail.com; s=zohoarc; b=XKnCfO/RwHpsq06LsFrhqNM1sAunk0vpUZAiAThTAwb5XeSnVn4Q0z5zf21Sp8CB8rnXNVaNt277w/aidO7Lyc3ccX5WI7PdBTqDPAHZ/zt5b/mEf66dVriMrmJrRjSScyvrRxaV/9GAsL02ydNZxgA0YO/84tn0D2gXw3o0UNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954444; 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=7W6Lt13Z1XJSZmU+RzaMy+Ab1ScstdHKGazxZ1Eo+0Y=; b=WVl9wB/sWJ2h/9TmalejRwYpt1L22C/EYl9c2Qwoqtt3ON6xBLJg8Zp4HK7QRCvO26V+jTcOeg/xU0mX9LTUQ9x/N9Cl+0LAgxIALIKRJ2AId2jTarTRkAmKPcNjY4nbPxBJfsd5371hXDomQqgbpguRUIPYbi7A7wXOHiBtSh0= 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 1770954443898188.79806197221785; Thu, 12 Feb 2026 19:47:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8Z-0008Jr-3Y; Thu, 12 Feb 2026 22:46:35 -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 1vqk8Y-0008JZ-2T for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:34 -0500 Received: from p-west1-cluster4-host6-snip4-4.eps.apple.com ([57.103.65.245] 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 1vqk8V-0005dp-Hf for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:33 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id F25E018002DA; Fri, 13 Feb 2026 03:46:25 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 190CD18002DF; Fri, 13 Feb 2026 03:46:21 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954390; x=1773546390; bh=7W6Lt13Z1XJSZmU+RzaMy+Ab1ScstdHKGazxZ1Eo+0Y=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=aBvInLKQp5IsGA3jJshKK2O1Qojo7n7oSbi3KPf5Bo2hwOJY5ooAcOuwvBup+GxQ+neoEKEk/wGfPCRc1r8A3vPN1JBrYzZ61ckDsWtELLqseToyNV8tu4pIXbCvm/t2DuF71pNP7KUNhIUbFuaiN1QwYdLTsJtQhXSyc9VTb3odl9P2Q4XEw+U3yQx6QChEYNKmux1jz7TfQyWapVJB038oLiFUzHZ09p/Mmxe75AOulvUL9iqlr/hpEGBnsSJKnBZyinCP4AUeSyel87KCs+mENK0mL1NyO043JlL21Bir08EyyV16QOthLG5yCF43aKQOdIftGW2Q7/p74ZxprA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 06/10] whpx: x86: switch over from winhvemulation to target/i386/emulate Date: Fri, 13 Feb 2026 04:45:49 +0100 Message-ID: <20260213034556.13471-7-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=E7XAZKdl c=1 sm=1 tr=0 ts=698e9e93 cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=1q5U6jd5_WdO0fZ7RH8A:9 X-Proofpoint-GUID: ZpnCxrVR65V0ZC5p4YTlkXHeIANvixmM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfXwqHG6SbFKonJ ggVBJ5X8i+jsLcg9M+0VhaoaRgDPPTm0GuOPINNEjV7QVNApcqozU+kst2RG+CSRp5ztjSvx1jG YK2MhBIADXJufNud4aZ2KAFZ2CuxjpSEUgDsbfERP6LvTpz6F5rUnlV4Qw4u7eglPh73aJGHdkx z4fR5yPzzjDQJfQiN+G2dZ9stGAd8y9psV3ZmkUrlNKxtpUc5BKY1YAcu9isnzaPwFxbmo8XoAC +C4U1Wl0OOHIFIqmhFT+nxNO62m9ssAQqy3cPjI9zSETsZU8zCj3PKXVtmdlnsQ7sIwa2ro8Tud CUicV4OojFimniwixMKK//cXOhz++5Lh0dHZ99d+jxJEBUDNdz0QTMZ6sCMX3A= X-Proofpoint-ORIG-GUID: ZpnCxrVR65V0ZC5p4YTlkXHeIANvixmM 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 clxscore=1030 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABFgBvSnawIyD3hkH+5yB/wXQl0QDziFHUEGJexEBxmTcnIYNmN1On+weP0ODX0JWOD9qlVQG7PWx0w8jcbmfYmH6HE8Rny5q/w04CPu4D9svUkkbZyUJUUYfN/DRmrqNOZikGdHeQZ+vYNuDPMOy2u+kunspOhk6RHccJST0ZwxgCcSV36QE3Y9UaYWixGBuM00FAJgWCrBFV484kY7hq4vqf2hPd2IgVuXmOmkAoRI5rNaugg4hgsa2/u8MZfIae5laj78ZqfClmTeLV4n3QAWaiGH64F1Gu2nRgI48mo4KwKlWWd4aiPmTOOPJJMQNlCTbg9Sjnr1WuF/Kf3DkWSxS2ZEIBQx0a5leQP926E80YbNTF9fxshsDwQM53VhBmrtWYnjbGCvXANl6JJ9UXlxUyj5sYJripfKdfrew0JexTlU8+5OTB0NOgTPG3jQrVMMZU6EP3LrBshhQ2wZPd3xi8gItRdAJKZbvL6Mcn/oPWStuuhD1acEkYBN/+XYiIymHsCiAC1Tx26Ta2V9l5PX/LMNAXqf4GfTkXmetk0cTRQnZ0W2Zka8UlWiFO0Kbtw+tEpI2ot1GD6z5cN0vm2lOW/J7dk5HuvVxT8Zfbj9GHvOiIkPl6WjEZ6dtjYw8b2pi/dhTaMZzxXWIkToKV7nhC9rpm5yXS1YvA9ul0/FIAkiURHZ5RJVwU1V4dF7PFbLLGgbnb+kTIblGF1ai7hwMVLocpZ2bfy7GdRS8OtSa4YI2MYcJRJzFetpQEawgNC357C1Vk0hP4NhFaqRjjkETSAF3DkOFO 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.65.245; 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: 1770954446986154100 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 Tested-by: Bernhard Beschow shentey@gmail.com --- target/i386/whpx/whpx-all.c | 250 ++++++++++++++++-------------------- 1 file changed, 114 insertions(+), 136 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index cdcaebbe16..eabb0ef913 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,12 @@ #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 "emulate/x86_mmu.h" + #include -#include =20 #define HYPERV_APIC_BUS_FREQUENCY (200000000ULL) =20 @@ -756,158 +761,138 @@ 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, const uint8_t *insn_bytes, s= ize_t insn_len) { - 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 }; + x86_insn_stream stream =3D { .bytes =3D insn_bytes, .len =3D insn_len = }; =20 -static HRESULT CALLBACK whpx_emu_mmio_callback( - void *ctx, - WHV_EMULATOR_MEMORY_ACCESS_INFO *ma) -{ - CPUState *cs =3D (CPUState *)ctx; - AddressSpace *as =3D cpu_addressspace(cs, MEMTXATTRS_UNSPECIFIED); + whpx_get_registers(cpu); + decode_instruction_stream(env, &decode, &stream); + exec_instruction(env, &decode); + whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); =20 - address_space_rw(as, ma->GpaAddress, MEMTXATTRS_UNSPECIFIED, - ma->Data, ma->AccessSize, ma->Direction); - return S_OK; + return 0; } =20 -static HRESULT CALLBACK whpx_emu_getreg_callback( - void *ctx, - const WHV_REGISTER_NAME *RegisterNames, - UINT32 RegisterCount, - WHV_REGISTER_VALUE *RegisterValues) +static int whpx_handle_mmio(CPUState *cpu, WHV_RUN_VP_EXIT_CONTEXT *exit_c= tx) { - HRESULT hr; - struct whpx_state *whpx =3D &whpx_global; - CPUState *cpu =3D (CPUState *)ctx; + WHV_MEMORY_ACCESS_CONTEXT *ctx =3D &exit_ctx->MemoryAccess; + int ret; =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); + ret =3D emulate_instruction(cpu, ctx->InstructionBytes, exit_ctx->VpCo= ntext.InstructionLength); + if (ret < 0) { + error_report("failed to emulate mmio"); + return -1; } =20 - return hr; + return 0; } =20 -static HRESULT CALLBACK whpx_emu_setreg_callback( - void *ctx, - const WHV_REGISTER_NAME *RegisterNames, - UINT32 RegisterCount, - const 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.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); + for (i =3D 0; i < count; i++) { + address_space_rw(&address_space_io, port, MEMTXATTRS_UNSPECIFIED, + ptr, size, + direction); + ptr +=3D size; } - - /* - * 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; } =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 void whpx_bump_rip(CPUState *cpu, WHV_RUN_VP_EXIT_CONTEXT *exit_ctx) { - HRESULT hr; - struct whpx_state *whpx =3D &whpx_global; - CPUState *cpu =3D (CPUState *)ctx; - WHV_TRANSLATE_GVA_RESULT res; - - 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; - } - - return hr; + WHV_REGISTER_VALUE reg; + whpx_get_reg(cpu, WHvX64RegisterRip, ®); + reg.Reg64 =3D exit_ctx->VpContext.Rip + exit_ctx->VpContext.Instructio= nLength; + whpx_set_reg(cpu, WHvX64RegisterRip, reg); } =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, -}; - -static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) +static int whpx_handle_portio(CPUState *cpu, + WHV_RUN_VP_EXIT_CONTEXT *exit_ctx) { - HRESULT hr; - AccelCPUState *vcpu =3D cpu->accel; - WHV_EMULATOR_STATUS emu_status; - - 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); - return -1; - } + 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 - if (!emu_status.EmulationSuccessful) { - error_report("WHPX: Failed to emulate MMIO access with" - " EmulatorReturnStatus: %u", emu_status.AsUINT32); + if (!ctx->AccessInfo.StringOp && !ctx->AccessInfo.IsWrite) { + uint64_t val =3D 0; + WHV_REGISTER_VALUE reg; + + 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, ctx->InstructionBytes, exit_ctx->VpCo= ntext.InstructionLength); + if (ret < 0) { + error_report("failed to emulate I/O port access"); return -1; } =20 return 0; } =20 -static int whpx_handle_portio(CPUState *cpu, - WHV_X64_IO_PORT_ACCESS_CONTEXT *ctx) +static void write_mem(CPUState *cpu, void *data, target_ulong addr, int by= tes) { - HRESULT hr; - AccelCPUState *vcpu =3D cpu->accel; - WHV_EMULATOR_STATUS emu_status; + vmx_write_mem(cpu, addr, data, bytes); +} =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= ); - return -1; - } +static void read_mem(CPUState *cpu, void *data, target_ulong addr, int byt= es) +{ + vmx_read_mem(cpu, data, addr, bytes); +} =20 - if (!emu_status.EmulationSuccessful) { - error_report("WHPX: Failed to emulate PortIO access with" - " EmulatorReturnStatus: %u", emu_status.AsUINT32); - return -1; +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(); } +} =20 - return 0; + +static const struct x86_emul_ops whpx_x86_emul_ops =3D { + .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); } =20 /* @@ -1279,8 +1264,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. */ @@ -1639,11 +1625,11 @@ int whpx_vcpu_run(CPUState *cpu) =20 switch (vcpu->exit_ctx.ExitReason) { case WHvRunVpExitReasonMemoryAccess: - ret =3D whpx_handle_mmio(cpu, &vcpu->exit_ctx.MemoryAccess); + ret =3D whpx_handle_mmio(cpu, &vcpu->exit_ctx); 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 +1976,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 +2042,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 +2233,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:48 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=1770954479; cv=none; d=zohomail.com; s=zohoarc; b=D04AV6M/jMdZ6KP4f7wQAy9UM0ZPUkZ5HRWUsp9X4Z/Ar8eIKC9xtsS/r2adTagnOjNNf0P5YSWaSSj1D3kURlho/R5gPR7TWaXtsy6Ry4Pxul/cs+DBYEPVe1ZTWO05AM8YtrK6/Z4aN+BXkMCpv2ENg8JEtH5p0kwiwJ7PunI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954479; 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=GMKDLR1ZRQkqFLoZNb51fIAURVKjNkL9YCABneXfO8s=; b=IFrF4cfjngD0X1pi8ctQdF+70jbflR6yhWbfVLbj5v6MaDSt1bup62xPaP0OgDEgwaqkpsT0Z7CjHme9eDMZ3IGVSY8ZZx2cC5uePZcyi0CGijajXM674oACzojFB3XXK+zQD3sAj9YJdCaO2p/xmP2Ju3Za0yO2ktDk7eMjCkk= 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 1770954478823977.1369566383785; Thu, 12 Feb 2026 19:47:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8X-0008JJ-DP; Thu, 12 Feb 2026 22:46:33 -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 1vqk8W-0008JA-Nh for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:32 -0500 Received: from p-west1-cluster4-host9-snip4-8.eps.apple.com ([57.103.65.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 1vqk8V-0005cn-06 for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:32 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id F1A1718002D8; Fri, 13 Feb 2026 03:46:28 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 9DF3518002E4; Fri, 13 Feb 2026 03:46:25 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954389; x=1773546389; bh=GMKDLR1ZRQkqFLoZNb51fIAURVKjNkL9YCABneXfO8s=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=E78hpZtczR9HOsmA/th4k1SVxOlPNpXl9zWh1N56arOMmt03iirWipJaqvXVwtpqHltsXnQ4TXeersshaQAjhVf7TODJ62yBVSGs7P93BaprUGOAmUspNamfWkD58UsZ4ylttO8otYq9dALY3uo0JRFTMo5IUgONy2xLKwbIfLlSHbUXJUJCGAqUMhwqdN8OMTMMZ5OOh533+4enB0TROzSIXCLSL2xP6VAzhizT5y+TMM6iiKpww8y+JG2TXF3OdJsFqyBUZ8XkdAbN9KNsxSyM9Na1/0QKTYLBtnBM0svylfrOINM/3PMmmjFRcXvmFLMntbUMtcNgpR9Bi6RbOw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 07/10] whpx: remove remaining winhvemulation support code Date: Fri, 13 Feb 2026 04:45:50 +0100 Message-ID: <20260213034556.13471-8-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 0vQIbi4TjvnbayvRVXZXamZJIroDiaIO X-Authority-Info-Out: v=2.4 cv=C5HkCAP+ c=1 sm=1 tr=0 ts=698e9e95 cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=UBzWkQmmy9v7-gCQCgEA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfX0cUYDt//7ha1 Ya9tqQpDjbujV91sLgup4LagCuHyHPRcHTXXx/f2m0QO2gvhm0/rF58dv1hs4NQpzQ2em2qHqqr EztXev0c9oOH89hy7wUNwchwKkDxH1G8v71swDAmLWCTf1v4wFfP6gr8zLBbHNdNKyBWUk3LZ5V /NCxmMN3ZC0lTaGSt33P2OkUB8/CzyE0FyLYzgxSVncEs+XzeXQ5ww2j6MO1AhFajR85m+VZk3C 4jT9Y0KKs4vSE3JaDlmWUw3bLzli0dAXHLabsHa9mbgy6Yk6CA3Ggir3gqgkpKIisiDa0aVFwrZ PX7tDAIObOQxR8hRPKRH8QKAD6378Be2zo5nQ25l93teuHchwsl/X1luIOF3P8= X-Proofpoint-ORIG-GUID: 0vQIbi4TjvnbayvRVXZXamZJIroDiaIO 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1030 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABMBoQz/FN1pyCXXvEdgmYa3bDf/DjMByqeHIwmaQR2sWLHXIc/lqVwI9w87+0wdbY0HOSRE0wgwUcCsOkVvfIuvsGCZSqBA3e3xaUIbLsSyzi/Pds+CqdHy3+JL6J2m6ykf64XIaoccu+wEIGGfuyv0sP4JjGnaWo/7hM5CSmk/DQDGdOZVmFDZTc1a6POcRNnMEmEtSuAq4ybWuYd0aNus9Wz1ccn68XLGnGn9IC8RXJc1LveLVyxMRcx8F07lM7vNOhGrJV4S4My8lXqtydvzZvtz1+PR1i91NKNDSsYz4qBlIQ3F9+tUGKQaMXSwsJpU3Kf97sR5VE6MhokfTpsG159U/xrOBM5hhVvc0YEE8JIYn82LxNMWulaKdvc9si0O3ULq3xNqZ/gohwO2YmQDmPAGWFG/DdHdXQ7kB81cClpBigv/EGy4k5KhuhsQJ5yoxSGj80OIzKw+BD7tWRYFjPjZTbUJU3RtoezcR52JXvZP2G7KjH3kpwynwxmUwJl0bkGUJtJRzHtMu9D2ZdChbu/PdtZxF5FO3LFoMjhiNU80ps1QWXAzpZfpIN5M+zY0IjJoapnidD9BjfRKaAHJEouaa6SslE+SjC7ZWCnxiDZZKYra151p58Ye56hGwhKi8Ui1YM0AbOxsnyWIHSGbqZ5Qk+JOdlxF9TZC3hz+PuolskSGSi1nOlIRCCbUWSycyaM5TRnXiBcINIuTCnLWykps0H+fbVMB/nEvb3i4QGjOUWBKhDokcE/vxQskiQqw/KFMqp/7hFmw4j7EppWEAOTWy5Aw== 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.65.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: 1770954482068158500 Content-Type: text/plain; charset="utf-8" After moving away to target/i386/emulate, this is no longer necessary. Signed-off-by: Mohamed Mediouni Tested-by: Bernhard Beschow shentey@gmail.com --- 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 e8fd77aac0..8f5e55810f 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:48 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=1770954496; cv=none; d=zohomail.com; s=zohoarc; b=LYbZbEcLjAxSsHHgY/SdBDiR6qLPpi/SvCnRIYDAOCycQ4EIq05VyonmdsljAH+O37c18GmBbjCfjbXXlZrf2Xdsh3EcB/xt7ne28NPzzhYxm5UCiKk6Q598o730EwA7tRHZ0bKgGjtHLrzllpZRe+GJOY2CmUlgzCIZDs+glio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954496; 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=NfP9NhkIXfWFxsOWMzbJrX5g2XsAZ34OoMJgPQ5NTe0=; b=TN4EGKtqF8LnNZV7p0YMSw53WasBXA4nwag7id3dKD/COtYEz/hhHIZ65atTmOJ55y948rbMKkAxQ18RN/kxzdA5jCv28c5gNh9IWGEZ8kG5ytdym19b782PJM45vf7fBpSSZ8xDdBf0pFNd0z8Ous/9Z7EH+EA9y9oI8FxKcfs= 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 1770954496515696.4853521302028; Thu, 12 Feb 2026 19:48:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8c-0008Lt-3v; Thu, 12 Feb 2026 22:46:38 -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 1vqk8a-0008K4-78 for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:36 -0500 Received: from p-west1-cluster4-host12-snip4-10.eps.apple.com ([57.103.65.231] 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 1vqk8Y-0005li-Ml for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:35 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id 7721718002E1; Fri, 13 Feb 2026 03:46:32 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 2DB1318002E6; Fri, 13 Feb 2026 03:46:28 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954393; x=1773546393; bh=NfP9NhkIXfWFxsOWMzbJrX5g2XsAZ34OoMJgPQ5NTe0=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=H9a5iMY71RX8nke4tNoqqG3Q/pL+PICs5af4Ke4e6MNEG2482Lhp89XjNw2DDq2Dd8VVpBmEMVBfQZ9LZMe9OyTgqHWdTwYVbMjeePf15a7gML/TdWqfWAcUw85ffzufzUrf37XlnvgPYgETxhbdv7DxNqElqBZRGOIP7ledZNN0II2XICiEY+onXdaG4KcljIyqUdpImYcqrL/hMWKO6j3ceLbI7DwkaV6XE5L8hfckIEoBVT23cgjdOhbAd0zlQ6gqg2M6E6gJGzO9CsCuCqpDM0SA3IyjkKZ5eRVKzcaTNbwlQ3ibSJUNB11S8PMgCPnRUPZt6wKaj1T60xFNaw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 08/10] whpx: x86: remove messages Date: Fri, 13 Feb 2026 04:45:51 +0100 Message-ID: <20260213034556.13471-9-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfXxxXhtvuYNTnL UdM2+5cRYuk1lWA8VHvuV6Jx3wjk5q58fcopufBOe+itAq3nee28uqboE0bziGbqXStcYLgpgs4 QcwzpeaWBlp8xKnzdCvGksVxoXYFHLP76JJytCyedW6LzHHfVCuuQOlTzUBWYup0nzZPedswOJb azcAg9vmCH5pzijuX5QrUhCbxy6jCLaSw77n6p/1dHcoPGPTYfQE2cMw29TZo4QsCwBgVo/1dqj hv7zVS9wbRISWZWQCx4T72V41Wns7RcnXH6n7Z+v//zO7gHq6MHVI0meh3SNzrI8Uk7qar21Faw bVcar5sTFNcpa/75gTUUp/5ULV7DQaOki6qzBvf8u8aowNfDvcUp+JAbLAcbIs= X-Proofpoint-ORIG-GUID: Mv84W_wcXPJsbF8_GxSK-vcXkZFYcZ7u X-Authority-Info-Out: v=2.4 cv=WLxyn3sR c=1 sm=1 tr=0 ts=698e9e98 cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=tHCKdM3VofH7q6B9RbgA:9 X-Proofpoint-GUID: Mv84W_wcXPJsbF8_GxSK-vcXkZFYcZ7u 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 clxscore=1030 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABU0/eBXE/FGf69TnZTYe+Td827Os1ZoyZrXFmOle0owSDEkGUePj4LpXmQHkp+ULIxCzSnl4ld0dZ6jQxSIBI6wshbKxlAZQgqbqJYLEPIIam/Q06EDBvI/58jfkkN7p9PPHBnN5CEl2X6kI1F9w3dXvsAsV0hUla2/gOQxADH9uxE8WltTZNandeXJiDYkpbrQSqrMajKbYxouQP1Y/MEojDnh5N4xzBdFk56GLxFe/AI2sHKJlzJV53/sVsQmlOgLe+JOH1yCOAZYav6PbskeDpv1wwG7R3IBpLtL/unwNko7zSnYGslMCXJF0ZF4VYg5RbtSmJGQgiVtCsr4cVvThzB431iC4xdo0BW6RaIPmj3Qk3LYsfMaBMGFF9BucH2Cv9ubkDCA1zNXB9B+BE163aflTZnZKCHShCT7Rj8TstrhjHC9EbBRLXpaq9pwe3ZNOu+mwyIzHA56tBuCZ4t8jl9iNB/V/H005maVvvHYVKp2zoc9z/L+iWpP2sm3dCaJJG3GQw9gJ11P3mlbh1Rm1DOz4dEtdaMQ3+K5VtyStLVbBVjQJ26oof6k6/CoBPUZh/klxTFfYz1OpPynx0Lk8eJd7oDgJ7j7mCZiQaTXjnRZYNEnxS7OndOJfBCgDobIMKV6iPVloe3ruAlr5HepiUsfkdHq4elsQ229uD7OHipoz/oTEErC/szvO+I+kybSdSUD5IpuJ71LTD3wMpMf4D0aMbki/ONlfxaSnOp4T6uD0DByxLGlvtM3IwV87A7ToddASvnAo8dpGENye+hjv73tuFpjbZ 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.65.231; 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_MSPIKE_H4=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: 1770954497653158500 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Bernhard Beschow shentey@gmail.com --- 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 eabb0ef913..e815ca9bfa 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2161,7 +2161,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, @@ -2235,7 +2234,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) From nobody Sun Apr 12 04:21:48 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=1770954437; cv=none; d=zohomail.com; s=zohoarc; b=nKdWNRkbMPZh4SlcdfIClkU7eP+Tj/aENsXsCXLOLCZ9XhdnFTq73jemFCkcp6Xvq5eu5jg6qc6EHmSTLM6yZTgLLX6tGp/fl+GOYSNcOuPC5SaS8v2K4iPqLjvvERL/MgCDD9+IqGzRfNeaJ63mRiRcINaZBbo2wzCF5M7Ru0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954437; 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=O7pcpgfwM6ECBoMunj3RQ37ql2fZKOaaMfhrgMDZZG8=; b=iKJShl7Cg0Al4OJ/+68N5uLhn112KYy4673mQ8vFgcKoZC4O13ySVYCX3VIBjBhUfsur1IvXRRwfWEiBfbfI00bDLCqxep1fdPWfqRWnjqfYVgc5FQ7KnyGmWTAgLnUo10N94NrSjCn9lsbgKiF/+HIRWIDgYHtsG20DfR4zBNc= 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 1770954437337445.9017699446588; Thu, 12 Feb 2026 19:47:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8g-0008NU-53; Thu, 12 Feb 2026 22:46:42 -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 1vqk8e-0008NH-K6 for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:40 -0500 Received: from p-west1-cluster4-host7-snip4-10.eps.apple.com ([57.103.65.181] 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 1vqk8c-0005tR-Ux for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:40 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id 32F3918002E6; Fri, 13 Feb 2026 03:46:36 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id AFA3418002E3; Fri, 13 Feb 2026 03:46:32 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954397; x=1773546397; bh=O7pcpgfwM6ECBoMunj3RQ37ql2fZKOaaMfhrgMDZZG8=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=HKX1N/ctpSFpQm5Pv8ph8yltbWwOmZxD/0KcLWvBjp05vbfeTPgZ8aFmNMn/sPBSs+AzO7OjVIyEEunXDzdASXp7IzVfRYVMjRwhqpWyCvqJuHXtNbUrsRGxHEqO4qEO8DiRoxtmqs0BhgiHVkNPSuXkApV4OHte3JCXb8q72tny3Hd4C/HTrKyl1AcE3iN21IghVZ8qbm4iQWt5RzTA6uio3TwkieR3k2kMvZK6Kyk1IfqI3l7KkGIPzoj5MrBd6wtAWZ6AxutLsXE+bqwwV15/Jz0GRA6a0/bphD6qzXruf/5DFX/MF5a1V8JRqyEmhi4bBptcUMMxnDdE6/1oHA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 09/10] whpx: i386: remove CPUID trapping Date: Fri, 13 Feb 2026 04:45:52 +0100 Message-ID: <20260213034556.13471-10-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: YhtuqlvwhCZrchmbnsjTBi2fEHN3TaqI X-Authority-Info-Out: v=2.4 cv=Qahrf8bv c=1 sm=1 tr=0 ts=698e9e9c cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=Gk9p9Fe9aJpBGj35TJ8A:9 X-Proofpoint-GUID: YhtuqlvwhCZrchmbnsjTBi2fEHN3TaqI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfXyXRz2XQCHypN 5o1helNaDarDwUDSsStMza1MgB5yIx37HZIp89WVTIrCQa8Rm0Apk5gl4E7kuDo9/JFh6pl/BPK iv0A4EpcKsD3eZZ6gYPdN1CWolLPVaj18H4GmvXmR4n47l/8qyvCS2TfHtnlGMsOiewp9MJj9Pi Iki0KopXI1PXGVUARR5h4/uPbkO/gOSr+NEaxQmLdR2Pl2fym8x/utBBKyVBwhhnK8MngPTocuC qZ4MlkFMeY2AqKIdmhFziryYYPKO/6RlDxDkfzwOuWLNj7Xut3oUopKo8kXK2mJhmFg9i1o6bNO j2zU82+eGtN7Nd1/Wmy0RWYST3CtDWMk/DqRHFgGVho3QB5PAaXEnUh20YVz3k= 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 clxscore=1030 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABMOmPJv531qsBnQPS1XKoTMDWy5WUdK4LqlpiU/FfBuTamSBc2VIrQ5cIFert3jyErTYlitBOoi/Fc8tTUaaZ5SM5uFI9urPxZNXq5OqEpaiEPVc3zR/abwS8Hz0DyihG5WRgDnDyPIJUO0iCTxGy9XzzQLJ9HAklRoZnRunnq5Ua8ba+tF42BmPSp0s+tIypo6q9CUjMIlIGQQyR217LXLtadmNUctqvhgNia6+cMTw74n64yV1U+n85XysCE1xFCyC3uYU/CxojGB1ouJ0PysqCU8R4AYwSEYGcQfuldWT9bF3FrIK/Sh7yURDgzWWeZDaZOdVM0U9jfXgCw+C1P9zzlD4mZhHiGk7aq5pQJH4q0xY9qGcLHgt9uK/mFqI1DqsDIZrKacbK7pVrKMZ+FqTJZK8Qt7GSZBGfzEcx8OEKaHSgBqCTeOKYaq/dWbVyoMur+eWAiAz8xwhao4Jp1wuSNpKlT/pOiT4tUd2tGTYD8rQvDJIWm5a4z60unXsQ1YN8TpfaY1cfVEL1R0cH4IbNriyqty3dENUAfeCb+nIp8Nj8DkRibCy0jCb/Ey/PIVI4PzdWPly5En/eJKVpTT7U+m4FkPAj84kXneeDDy6hrJRgDAySErhvG9CllPOHX+/+GJJGlL0OoV86z/ceB82FThzGxqBz8io4u17EI7YEDJvWox2KFLxAlEBTPvuXWgMpZnATZp0njX/hxAsp+/bpYsl07MApzvIRkUUvh3J1N4UzRB/NjQ4rIavdiJRTnWLiQNaxfUjpulq4DshXlbzA4UxxdX3HTuX12xKzfCdq 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.65.181; 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_MSPIKE_H2=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: 1770954438796154100 Content-Type: text/plain; charset="utf-8" Very partial in its current state and results in significantly inconsistent CPUID data. Remove it until it's reimplemented later. Signed-off-by: Mohamed Mediouni Tested-by: Bernhard Beschow shentey@gmail.com --- target/i386/whpx/whpx-all.c | 104 ------------------------------------ 1 file changed, 104 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index e815ca9bfa..0e8fb0e72e 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1793,75 +1793,6 @@ int whpx_vcpu_run(CPUState *cpu) ret =3D 0; break; } - case WHvRunVpExitReasonX64Cpuid: { - WHV_REGISTER_VALUE reg_values[5]; - WHV_REGISTER_NAME reg_names[5]; - UINT32 reg_count =3D 5; - UINT64 cpuid_fn, rip =3D 0, rax =3D 0, rcx =3D 0, rdx =3D 0, r= bx =3D 0; - X86CPU *x86_cpu =3D X86_CPU(cpu); - CPUX86State *env =3D &x86_cpu->env; - - memset(reg_values, 0, sizeof(reg_values)); - - rip =3D vcpu->exit_ctx.VpContext.Rip + - vcpu->exit_ctx.VpContext.InstructionLength; - cpuid_fn =3D vcpu->exit_ctx.CpuidAccess.Rax; - - /* - * Ideally, these should be supplied to the hypervisor during = VCPU - * initialization and it should be able to satisfy this reques= t. - * But, currently, WHPX doesn't support setting CPUID values i= n the - * hypervisor once the partition has been setup, which is too = late - * since VCPUs are realized later. For now, use the values from - * QEMU to satisfy these requests, until WHPX adds support for - * being able to set these values in the hypervisor at runtime. - */ - cpu_x86_cpuid(env, cpuid_fn, 0, (UINT32 *)&rax, (UINT32 *)&rbx, - (UINT32 *)&rcx, (UINT32 *)&rdx); - switch (cpuid_fn) { - case 0x40000000: - /* Expose the vmware cpu frequency cpuid leaf */ - rax =3D 0x40000010; - rbx =3D rcx =3D rdx =3D 0; - break; - - case 0x40000010: - rax =3D env->tsc_khz; - rbx =3D env->apic_bus_freq / 1000; /* Hz to KHz */ - rcx =3D rdx =3D 0; - break; - - case 0x80000001: - /* Remove any support of OSVW */ - rcx &=3D ~CPUID_EXT3_OSVW; - break; - } - - reg_names[0] =3D WHvX64RegisterRip; - reg_names[1] =3D WHvX64RegisterRax; - reg_names[2] =3D WHvX64RegisterRcx; - reg_names[3] =3D WHvX64RegisterRdx; - reg_names[4] =3D WHvX64RegisterRbx; - - reg_values[0].Reg64 =3D rip; - reg_values[1].Reg64 =3D rax; - reg_values[2].Reg64 =3D rcx; - reg_values[3].Reg64 =3D rdx; - reg_values[4].Reg64 =3D rbx; - - hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( - whpx->partition, cpu->cpu_index, - reg_names, - reg_count, - reg_values); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set CpuidAccess state regist= ers," - " hr=3D%08lx", hr); - } - ret =3D 0; - break; - } case WHvRunVpExitReasonException: whpx_get_registers(cpu); =20 @@ -2015,26 +1946,6 @@ int whpx_init_vcpu(CPUState *cpu) } } =20 - /* - * If the vmware cpuid frequency leaf option is set, and we have a val= id - * tsc value, trap the corresponding cpuid's. - */ - if (x86_cpu->vmware_cpuid_freq && env->tsc_khz) { - UINT32 cpuidExitList[] =3D {1, 0x80000001, 0x40000000, 0x40000010}; - - hr =3D whp_dispatch.WHvSetPartitionProperty( - whpx->partition, - WHvPartitionPropertyCodeCpuidExitList, - cpuidExitList, - RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32)); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set partition CpuidExitList hr= =3D%08lx", - hr); - ret =3D -EINVAL; - goto error; - } - } =20 vcpu->interruptable =3D true; cpu->vcpu_dirty =3D true; @@ -2071,7 +1982,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) WHV_CAPABILITY whpx_cap; UINT32 whpx_cap_size; WHV_PARTITION_PROPERTY prop; - UINT32 cpuidExitList[] =3D {1, 0x80000001}; WHV_CAPABILITY_FEATURES features =3D {0}; =20 whpx =3D &whpx_global; @@ -2181,7 +2091,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) /* Register for MSR and CPUID exits */ memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY)); prop.ExtendedVmExits.X64MsrExit =3D 1; - prop.ExtendedVmExits.X64CpuidExit =3D 1; prop.ExtendedVmExits.ExceptionExit =3D 1; if (whpx_irqchip_in_kernel()) { prop.ExtendedVmExits.X64ApicInitSipiExitTrap =3D 1; @@ -2198,19 +2107,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) goto error; } =20 - hr =3D whp_dispatch.WHvSetPartitionProperty( - whpx->partition, - WHvPartitionPropertyCodeCpuidExitList, - cpuidExitList, - RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32)); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set partition CpuidExitList hr=3D%08= lx", - hr); - ret =3D -EINVAL; - goto error; - } - /* * We do not want to intercept any exceptions from the guest, * until we actually start debugging with gdb. --=20 2.50.1 (Apple Git-155) From nobody Sun Apr 12 04:21:48 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=1770954465; cv=none; d=zohomail.com; s=zohoarc; b=LTIfGkvkZL1HESR/zmVTNA7tSTbhU0eNBpnC8dGZLgUDp8m/wzIq/ykRQEHbrPYxbc403G1x39Up+eMQgvE3f5gGldWFnrUr7A/cwNA1xmNfS318102wiOoBwxWN/ZWa0sIdZiFLVbypEMad13LF7ljVfhebqt5kA3E5ZxPqwiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954465; 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=9sUcaeoz6C4CulqwK75rnnECZ/Yp9/cyUOcLGfOPaHE=; b=Ae1PP9XRlKKELANvXY+/u/irDbTS30Yzw/4ZqFkoQxIG+bdGP6XhKsg5fKqJrZ25oxizsfPDXko71QJp+RLuF3g0KVUaqqSOESgIO5R7GO4Y1iiXWSEqrjfKiFRDtz4+OP50NFPp+WxeeE2PMpTY5Qf6Wp16CLsr9ZeUwoUD5/k= 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 1770954465117105.83322654525432; Thu, 12 Feb 2026 19:47:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8j-0008QB-JO; Thu, 12 Feb 2026 22:46:45 -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 1vqk8i-0008OL-6V for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:44 -0500 Received: from p-west1-cluster4-host2-snip4-10.eps.apple.com ([57.103.65.151] 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 1vqk8g-0005ti-J0 for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:43 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id 897C018002DF; Fri, 13 Feb 2026 03:46:39 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id 3F0C318002E7; Fri, 13 Feb 2026 03:46:36 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954400; x=1773546400; bh=9sUcaeoz6C4CulqwK75rnnECZ/Yp9/cyUOcLGfOPaHE=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=AR0AxXROQDzB193Ge8KjhrVyS6btpJUj/TMsJuDK26Mszm+tG87FZ1mCa6AAszQRz5uLPjJMEHRz/txMggv1xg72thXuJoNOgJuPiBTS+6gFTWuEstcfp7TIsPWb3aK/wpM/GeX27gVFk4fIDCZtc43XJHHS4L9CvDyzl0KR3UH8RQkXJk48kgijjByqlS6iU+e0M46q0bL/qDA7k79oSbNxxsnQ9ZaFM1pOQn2OiSOfi9k+HZjx2gd8Y7QiD50ZZKInHZWTgZTAvHdiEPELbKZx7o1/EwWrXk5AalLf0d34u1sxqfu7o94fqG0B7qWeAUoaAPlPb7TwjNaIZer3dg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 10/10] whpx: x86: optimise MMIO vmexit by only restoring needed registers Date: Fri, 13 Feb 2026 04:45:53 +0100 Message-ID: <20260213034556.13471-11-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: cNIj7Afb4kT9UpQebrC6E2oyeumOb4De X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfX8lFIho0EPRpj ogr6Gu6J9838YPGloZfJDY9bO5fGY5mzmqR4B9T0qMRWMTovznweoNyS1whQUKVeyuVJord5ymc /oEcW1AUIlyzz/eztnUTMWfO950AOh1LYMdUY53KOk6diDXOfE9Ekdxb79X9kBzCf+X9Iqo4MWp orPfzPv1bWKmCBLV+jBeyfcih+ohUdyAgKSxumkrLyf3yK05BInFOgVcItaJmLf2bGnQAubVV7r 3OGAk/OCiuHq9V+LlyaSAvpbGRUm/Xq5Ya19QNWNyjHgX/5jPix5+QC+jr72E1V8QKdRJmkbyyf /LwIT9I4CNrvgRYhxeCrwCDFiCcOSctUawVnjn0VCgURtShmHbYkFGZU+7wBzA= X-Proofpoint-GUID: cNIj7Afb4kT9UpQebrC6E2oyeumOb4De X-Authority-Info-Out: v=2.4 cv=QPRlhwLL c=1 sm=1 tr=0 ts=698e9ea0 cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=WklI_BSY2m36_CZppDAA:9 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1030 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABgZbtO77xBwNm/5KT6Ys/W//a3J9WytbP4X9T68gSIbwzsFVE2FUanxifmyop7iBbySJjr/+kg1x9MRyQhofQvFzm7VJjCUZV851b8pA38vqGQG9B4jUbviLoirJKGL9imwkID8DfYgs2JRMbCfZoS8N6kmaQjk5h7rKhs7fHdaHO1PMerA0ibexgANyyPrdKR/619FArZhmlzACTQ33J6zx9JJRxjU+wYFMzeJ8cWFQewC+BQPT6PM9Nqqy6OLMcGRm7LKJWpXyzyiVHPDjCY8DDLEYoisMB2NRaN+ZpDywn/yoXtWcxCfcM4PB+iyhAFQmBH+gMmWFS5v+xFBWNJGLT6kXeVgkw/HgcKtM/dYO8CD6aBu1QWQQ9CklTdoTHQHffHMdShRN7I5TozATJFwhzypO4E7YhxIvwLK/8Hx4Bm6u2shWre8Ht0mmJuZeuP4koxNDBq7LpSaVI1FgvpYN1C46siJ6NaGsYWQSGWq60y+EGHHCZTLPC1hJMetioaqgcwI0TgdG/+cMSUeBhjPNfZswsQwG/yYgr3sDRn/LabgoFICEXO4xa1fMJJgDf3G51powenhiLrnTz10i/5EvAuiYOBokHopdQ5VrKR4hmpvi+f/e3IwzsCE7tVTLrLb6BaQBPqYmJIIKHtEKxmgNPnYIugYAqnGJJS3VEnVu/db3JZKQZkpugLnToE4llUcrWMjN/TGZ0T7NL/jbVJw/8pGVOz8pg5gaelTBhqLY5AUOX0ufzU1O4pma37wN1ZBWTXZ4fnTii4MPwPEU4bW65rkANLtjyuBIzHahP 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.65.151; 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_MSPIKE_H4=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: 1770954467447158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Bernhard Beschow shentey@gmail.com --- include/system/whpx-accel-ops.h | 8 +++++--- target/i386/whpx/whpx-all.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/system/whpx-accel-ops.h b/include/system/whpx-accel-op= s.h index ed9d4c49f4..469a3a4350 100644 --- a/include/system/whpx-accel-ops.h +++ b/include/system/whpx-accel-ops.h @@ -22,11 +22,13 @@ void whpx_cpu_synchronize_post_reset(CPUState *cpu); void whpx_cpu_synchronize_post_init(CPUState *cpu); void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu); =20 +/* subset of runtime state for faster returns from vmexit */ +#define WHPX_SET_FAST_RUNTIME_STATE 1 /* state subset only touched by the VCPU itself during runtime */ -#define WHPX_SET_RUNTIME_STATE 1 +#define WHPX_SET_RUNTIME_STATE 2 /* state subset modified during VCPU reset */ -#define WHPX_SET_RESET_STATE 2 +#define WHPX_SET_RESET_STATE 3 /* full state set, modified during initialization or on vmload */ -#define WHPX_SET_FULL_STATE 3 +#define WHPX_SET_FULL_STATE 4 =20 #endif /* TARGET_I386_WHPX_ACCEL_OPS_H */ diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 0e8fb0e72e..61251a2835 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -420,6 +420,13 @@ void whpx_set_registers(CPUState *cpu, int level) vcxt.values[idx].Segment =3D whpx_seg_q2h(&env->segs[i], v86, r86); } =20 + /* + * This is a hot path called on every MMIO access. + */ + if (level <=3D WHPX_SET_FAST_RUNTIME_STATE) { + goto skip_to_set_registers; + } + assert(idx =3D=3D WHvX64RegisterLdtr); vcxt.values[idx++].Segment =3D whpx_seg_q2h(&env->ldt, 0, 0); =20 @@ -529,10 +536,11 @@ void whpx_set_registers(CPUState *cpu, int level) =20 assert(idx =3D=3D RTL_NUMBER_OF(whpx_register_names)); =20 + skip_to_set_registers: hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( whpx->partition, cpu->cpu_index, whpx_register_names, - RTL_NUMBER_OF(whpx_register_names), + idx, &vcxt.values[0]); =20 if (FAILED(hr)) { @@ -771,7 +779,7 @@ static int emulate_instruction(CPUState *cpu, const uin= t8_t *insn_bytes, size_t whpx_get_registers(cpu); decode_instruction_stream(env, &decode, &stream); exec_instruction(env, &decode); - whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); + whpx_set_registers(cpu, WHPX_SET_FAST_RUNTIME_STATE); =20 return 0; } --=20 2.50.1 (Apple Git-155)